diff --git a/.rubocop.yml b/.rubocop.yml index 168ee8a..9577cfd 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,10 @@ inherit_from: - https://raw.githubusercontent.com/gmcgibbon/dotfiles/main/rubocop.yml +require: + - rubocop-rails + - rubocop-capybara + AllCops: TargetRubyVersion: 3.3.0 Exclude: diff --git a/Gemfile b/Gemfile index 725c7eb..50aa18e 100644 --- a/Gemfile +++ b/Gemfile @@ -62,6 +62,7 @@ gem "blog", path: "blog" # Code linting gem "rubocop", require: false +gem "rubocop-capybara" gem "rubocop-rails", require: false gem "tailwindcss-rails" diff --git a/Gemfile.lock b/Gemfile.lock index db3dc87..43b0cc7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -241,6 +241,8 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.30.0) parser (>= 3.2.1.0) + rubocop-capybara (2.19.0) + rubocop (~> 1.41) rubocop-rails (2.12.4) activesupport (>= 4.2.0) rack (>= 1.1) @@ -318,6 +320,7 @@ DEPENDENCIES rack-mini-profiler (~> 2.0) rails! rubocop + rubocop-capybara rubocop-rails selenium-webdriver (= 4.0.0.beta3) spring diff --git a/app/components/application_page_component.rb b/app/components/application_page_component.rb index 5ee101f..2e2e3e9 100644 --- a/app/components/application_page_component.rb +++ b/app/components/application_page_component.rb @@ -9,10 +9,10 @@ class ApplicationPageComponent < ApplicationComponent def favicon_meta_tags [ - tag("link", rel: "icon", href: "/favicon.ico", sizes: "any"), - tag("link", rel: "icon", href: "/icon.svg", type: "image/svg+xml"), - tag("link", rel: "apple-touch-icon", href: "/apple-touch-icon.png", type: "image/svg+xml"), - tag("link", rel: "manifest", href: "/manifest.webmanifest") - ].join("\n").html_safe + tag.link(rel: "icon", href: "/favicon.ico", sizes: "any"), + tag.link(rel: "icon", href: "/icon.svg", type: "image/svg+xml"), + tag.link(rel: "apple-touch-icon", href: "/apple-touch-icon.png", type: "image/svg+xml"), + tag.link(rel: "manifest", href: "/manifest.webmanifest") + ].join("\n").html_safe # rubocop:disable Rails/OutputSafety end end diff --git a/blog/lib/blog/document_renderer.rb b/blog/lib/blog/document_renderer.rb index b263bc7..f1ee4eb 100644 --- a/blog/lib/blog/document_renderer.rb +++ b/blog/lib/blog/document_renderer.rb @@ -19,7 +19,7 @@ def render_erb(text, context:) end def render_md(text, context:) # rubocop:disable Lint/UnusedMethodArgument - markdown_parser.render(text).html_safe + markdown_parser.render(text).html_safe # rubocop:disable Rails/OutputSafety end def markdown_parser diff --git a/blog/test/models/article_test.rb b/blog/test/models/article_test.rb index 77454e4..7dff279 100644 --- a/blog/test/models/article_test.rb +++ b/blog/test/models/article_test.rb @@ -46,7 +46,7 @@ class ArticleTest < ActiveSupport::TestCase end test "#render_in" do - today = Date.today.strftime("%A") + today = Time.zone.today.strftime("%A") context = time_context(day: today) diff --git a/config/environments/development.rb b/config/environments/development.rb index d58f8e2..24fc277 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -18,7 +18,7 @@ # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. - if Rails.root.join("tmp", "caching-dev.txt").exist? + if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true diff --git a/test/test_helper.rb b/test/test_helper.rb index 3af3800..6c348c5 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -9,7 +9,7 @@ class TestCase # Run tests in parallel with specified workers parallelize(workers: :number_of_processors) - self.file_fixture_path = "#{Rails.root}/test/fixtures/files" + self.file_fixture_path = Rails.root.join("test/fixtures/files").to_s ApplicationRecord.base_path = Pathname.new(file_fixture_path)