Skip to content

Commit 2a896e8

Browse files
committed
correct rubocop offenses after upgrading rails and rubocop
This also fixes the CI Lint test failed first time
1 parent 5d8d5a5 commit 2a896e8

25 files changed

+59
-26
lines changed

app/controllers/pages_controller.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ def comments_json_string
5050
end
5151

5252
def render_html
53-
respond_to do |format|
54-
format.html
55-
end
53+
respond_to(&:html)
5654
end
5755
end

config/application.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require_relative "boot"
24

35
require "rails/all"

config/boot.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
24

35
require "bundler/setup" # Set up gems listed in the Gemfile.

config/environment.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Load the Rails application.
24
require_relative "application"
35

config/environments/development.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "active_support/core_ext/integer/time"
24

35
Rails.application.configure do

config/environments/production.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "active_support/core_ext/integer/time"
24

35
Rails.application.configure do
@@ -34,8 +36,8 @@
3436
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
3537

3638
# Log to STDOUT with the current request id as a default log tag.
37-
config.log_tags = [ :request_id ]
38-
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
39+
config.log_tags = [:request_id]
40+
config.logger = ActiveSupport::TaggedLogging.logger($stdout)
3941

4042
# Change to "debug" to log everything (including potentially personally-identifiable information!)
4143
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
@@ -76,7 +78,7 @@
7678
config.active_record.dump_schema_after_migration = false
7779

7880
# Only use :id for inspections in production.
79-
config.active_record.attributes_for_inspect = [ :id ]
81+
config.active_record.attributes_for_inspect = [:id]
8082

8183
# Enable DNS rebinding protection and other `Host` header attacks.
8284
# config.hosts = [

config/environments/test.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# The test environment is used exclusively to run your application's
24
# test suite. You never need to work with it otherwise. Remember that
35
# your test database is "scratch space" for the test suite and is wiped

config/initializers/application_controller_renderer.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# frozen_string_literal: true
2+
23
# Be sure to restart your server when you modify this file.
34

45
# ActiveSupport::Reloader.to_prepare do

config/initializers/assets.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Be sure to restart your server when you modify this file.
24

35
# Version of your assets, change this if you want to expire all your assets.

config/initializers/content_security_policy.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Be sure to restart your server when you modify this file.
24

35
# Define an application-wide content security policy.

config/initializers/cors.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Be sure to restart your server when you modify this file.
24

35
# Avoid CORS issues when API is called from the frontend app.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
# frozen_string_literal: true
2+
13
# Be sure to restart your server when you modify this file.
24

35
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
46
# Use this to limit dissemination of sensitive information.
57
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
6-
Rails.application.config.filter_parameters += [
7-
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
8+
Rails.application.config.filter_parameters += %i[
9+
passw email secret token _key crypt salt certificate otp ssn cvv cvc
810
]

config/initializers/inflections.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Be sure to restart your server when you modify this file.
24

35
# Add new inflection rules using the following format. Inflections

config/initializers/mime_types.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# frozen_string_literal: true
2+
23
# Be sure to restart your server when you modify this file.
34

45
# Add new mime types for use in respond_to blocks:

config/initializers/new_framework_defaults_7_0.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# frozen_string_literal: true
2+
23
# Be sure to restart your server when you modify this file.
34
#
45
# This file eases your Rails 7.0 framework defaults upgrade.

config/initializers/new_framework_defaults_7_2.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Be sure to restart your server when you modify this file.
24
#
35
# This file eases your Rails 7.2 framework defaults upgrade.

config/initializers/new_framework_defaults_8_0.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Be sure to restart your server when you modify this file.
24
#
35
# This file eases your Rails 8.0 framework defaults upgrade.

config/initializers/permissions_policy.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Be sure to restart your server when you modify this file.
24

35
# Define an application-wide HTTP permissions policy. For further

config/puma.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# This configuration file will be evaluated by Puma. The top-level methods that
24
# are invoked here are part of Puma's configuration DSL. For more information
35
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.

lib/tasks/ci.rake

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if Rails.env.development? || Rails.env.test?
2626
puts Rainbow("PASSED").green
2727
puts ""
2828
rescue StandardError => e
29-
puts e.to_s
29+
puts e
3030
puts Rainbow("FAILED").red
3131
puts ""
3232
raise(e)
@@ -38,7 +38,7 @@ if Rails.env.development? || Rails.env.test?
3838
puts Rainbow("PASSED").green
3939
puts ""
4040
rescue StandardError => e
41-
puts e.to_s
41+
puts e
4242
puts Rainbow("FAILED").red
4343
puts ""
4444
raise(e)
@@ -50,7 +50,7 @@ if Rails.env.development? || Rails.env.test?
5050
puts Rainbow("PASSED").green
5151
puts ""
5252
rescue StandardError => e
53-
puts e.to_s
53+
puts e
5454
puts Rainbow("FAILED").red
5555
puts ""
5656
raise(e)

spec/rails_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)
4545

4646
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
47-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
47+
config.fixture_path = Rails.root.join("spec/fixtures")
4848

4949
# If you're not using ActiveRecord, or you'd prefer not to run each of your
5050
# examples within a transaction, remove the following line or assign false

spec/rescript/rescript_spec.rb

+8-7
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@
99
end
1010

1111
it "shows horizontal tab on visit" do
12-
page.has_css?("form-horizontal")
12+
expect(page).to have_css(".form-horizontal")
1313
end
1414

1515
it "stops showing horizontal tab when other tab is clicked" do
16-
find("button", text: "Inline Form")
17-
page.has_no_css?("form-horizontal")
16+
find("button", text: "Inline Form").click
17+
expect(page).to have_no_css(".form-horizontal")
1818
end
1919

2020
it "shows inline form when Inline Form link is clicked" do
21-
find("button", text: "Inline Form", wait: 10)
22-
page.has_css?("form-inline")
21+
find("button", text: "Inline Form").click
22+
expect(page).to have_css(".form-inline")
2323
end
2424

2525
it "shows stacked form when Stacked Form link is clicked" do
26-
find("button", text: "Stacked Form")
27-
page.has_no_css?("form-inline") and page.has_no_css?("form-horizontal")
26+
find("button", text: "Stacked Form").click
27+
expect(page).to have_no_css(".form-inline")
28+
expect(page).to have_no_css(".form-horizontal")
2829
end
2930
end
3031

spec/stimulus/turbo_spec.rb

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@
99
end
1010

1111
it "shows horizontal tab on visit" do
12-
page.has_css?("form-horizontal")
12+
expect(page).to have_css(".form-horizontal")
1313
end
1414

1515
it "stops showing horizontal tab when other tab is clicked" do
1616
click_link("Inline Form")
17-
page.has_no_css?("form-horizontal")
17+
expect(page).to have_no_css(".form-horizontal")
1818
end
1919

2020
it "shows inline form when Inline Form link is clicked" do
2121
click_link("Inline Form")
22-
page.has_css?("form-inline")
22+
expect(page).to have_css(".form-inline")
2323
end
2424

2525
it "shows stacked form when Stacked Form link is clicked" do
2626
click_link("Stacked Form")
27-
page.has_no_css?("form-inline") and page.has_no_css?("form-horizontal")
27+
expect(page).to have_no_css(".form-inline")
28+
expect(page).to have_no_css(".form-horizontal")
2829
end
2930
end
3031

spec/system/destroy_comment_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require "rails_helper"
44
require "system/shared/contexts"
55

6-
describe "Destroy a comment", existing_comment: true do
6+
describe "Destroy a comment", :existing_comment do
77
context "when from classic page" do
88
let(:comment) { build(:comment) }
99

spec/system/edit_comment_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require "rails_helper"
44
require "system/shared/contexts"
55

6-
describe "Edit a comment", existing_comment: true do
6+
describe "Edit a comment", :existing_comment do
77
let(:comment) { build(:comment) }
88
let(:edited_name) { "Abraham Lincoln" }
99

@@ -20,7 +20,7 @@
2020
expect(page).to have_css("#notice", text: "Comment was successfully updated.")
2121
end
2222

23-
it "comment is not updated when edit is submitted with blank fields", blank_form_submitted: true do
23+
it "comment is not updated when edit is submitted with blank fields", :blank_form_submitted do
2424
visit comments_path
2525
click_link "New Comment"
2626
submit_form

0 commit comments

Comments
 (0)