From 7f8e2583f6c47eb343da7feb27377ce726635118 Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Fri, 20 Oct 2023 18:04:10 +0100 Subject: [PATCH 01/13] Update rubocop from 1.31 to 1.45 (Large update) --- cucumber-rails.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cucumber-rails.gemspec b/cucumber-rails.gemspec index eb4b6805..ad0bfd40 100644 --- a/cucumber-rails.gemspec +++ b/cucumber-rails.gemspec @@ -36,7 +36,7 @@ Gem::Specification.new do |s| s.add_development_dependency('rails', '>= 5.2', '< 8') s.add_development_dependency('rake', '>= 12.0') s.add_development_dependency('rspec', '~> 3.6') - s.add_development_dependency('rubocop', '~> 1.31.0') + s.add_development_dependency('rubocop', '~> 1.45.0') s.add_development_dependency('rubocop-packaging', '~> 0.5.1') s.add_development_dependency('rubocop-performance', '~> 1.17.0') s.add_development_dependency('rubocop-rspec', '~> 2.12.0') From 9051c857fb1ebb1c37c294ba5292cbcb0916ad4c Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Fri, 20 Oct 2023 18:04:48 +0100 Subject: [PATCH 02/13] AF: Style/RedundantConstantBase --- lib/cucumber/rails/capybara/javascript_emulation.rb | 4 ++-- lib/cucumber/rails/capybara/select_dates_and_times.rb | 2 +- lib/cucumber/rails/hooks/mail.rb | 2 +- spec/generators/cucumber/install_generator_spec.rb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/cucumber/rails/capybara/javascript_emulation.rb b/lib/cucumber/rails/capybara/javascript_emulation.rb index 6c3bc2f4..11513d97 100644 --- a/lib/cucumber/rails/capybara/javascript_emulation.rb +++ b/lib/cucumber/rails/capybara/javascript_emulation.rb @@ -108,14 +108,14 @@ class Node Before('not @no-js-emulation') do # Enable javascript emulation - ::Capybara::RackTest::Node.class_eval do + Capybara::RackTest::Node.class_eval do alias_method :click, :click_with_javascript_emulation end end Before('@no-js-emulation') do # Disable javascript emulation - ::Capybara::RackTest::Node.class_eval do + Capybara::RackTest::Node.class_eval do alias_method :click, :click_without_javascript_emulation end end diff --git a/lib/cucumber/rails/capybara/select_dates_and_times.rb b/lib/cucumber/rails/capybara/select_dates_and_times.rb index 1018e9cc..72565d12 100644 --- a/lib/cucumber/rails/capybara/select_dates_and_times.rb +++ b/lib/cucumber/rails/capybara/select_dates_and_times.rb @@ -70,4 +70,4 @@ def get_base_dom_id_from_label_tag(field) end end -World(::Cucumber::Rails::Capybara::SelectDatesAndTimes) +World(Cucumber::Rails::Capybara::SelectDatesAndTimes) diff --git a/lib/cucumber/rails/hooks/mail.rb b/lib/cucumber/rails/hooks/mail.rb index 85761ce9..9002427a 100644 --- a/lib/cucumber/rails/hooks/mail.rb +++ b/lib/cucumber/rails/hooks/mail.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -if defined?(::ActionMailer) +if defined?(ActionMailer) Before do ActionMailer::Base.deliveries = [] end diff --git a/spec/generators/cucumber/install_generator_spec.rb b/spec/generators/cucumber/install_generator_spec.rb index 3e005eeb..61c4f1c2 100644 --- a/spec/generators/cucumber/install_generator_spec.rb +++ b/spec/generators/cucumber/install_generator_spec.rb @@ -65,7 +65,7 @@ def create_config_files_the_generator_is_expected_to_modify it { is_expected.to contain 'load Cucumber::BINARY' } end - if ::Rails::VERSION::MAJOR >= 6 + if Rails::VERSION::MAJOR >= 6 %w[development test].each do |environment| describe "config/environments/#{environment}.rb" do subject { file("config/environments/#{environment}.rb") } From aa9d37da8477cf78a66e7e5c0d5fcb97efc192b5 Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Fri, 20 Oct 2023 18:05:33 +0100 Subject: [PATCH 03/13] AF: Style/RedundantStringEscape --- lib/cucumber/rails.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cucumber/rails.rb b/lib/cucumber/rails.rb index 7722dcc3..9be66ac4 100644 --- a/lib/cucumber/rails.rb +++ b/lib/cucumber/rails.rb @@ -32,7 +32,7 @@ MultiTest.disable_autorun else warn "WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being deferred - until env.rb is called. To avoid this warning, move 'gem \'cucumber-rails\', require: false' + until env.rb is called. To avoid this warning, move 'gem 'cucumber-rails', require: false' under only group :test in your Gemfile. If already in the :test group, be sure you are specifying 'require: false'." end From 82c07f0d901c4e4908c723c657dd5f3bfc35a592 Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Fri, 20 Oct 2023 18:06:29 +0100 Subject: [PATCH 04/13] Update packaging to latest version to mitigating spam deprecations --- cucumber-rails.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cucumber-rails.gemspec b/cucumber-rails.gemspec index ad0bfd40..3c159536 100644 --- a/cucumber-rails.gemspec +++ b/cucumber-rails.gemspec @@ -37,7 +37,7 @@ Gem::Specification.new do |s| s.add_development_dependency('rake', '>= 12.0') s.add_development_dependency('rspec', '~> 3.6') s.add_development_dependency('rubocop', '~> 1.45.0') - s.add_development_dependency('rubocop-packaging', '~> 0.5.1') + s.add_development_dependency('rubocop-packaging', '~> 0.5.2') s.add_development_dependency('rubocop-performance', '~> 1.17.0') s.add_development_dependency('rubocop-rspec', '~> 2.12.0') From bf18aacd4090c30bb3783621e6b589d797843622 Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Fri, 20 Oct 2023 18:08:17 +0100 Subject: [PATCH 05/13] Add in latest version of rubocop-rake and reasonably up to date version of rubocop-rails --- cucumber-rails.gemspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cucumber-rails.gemspec b/cucumber-rails.gemspec index 3c159536..051ca539 100644 --- a/cucumber-rails.gemspec +++ b/cucumber-rails.gemspec @@ -39,6 +39,8 @@ Gem::Specification.new do |s| s.add_development_dependency('rubocop', '~> 1.45.0') s.add_development_dependency('rubocop-packaging', '~> 0.5.2') s.add_development_dependency('rubocop-performance', '~> 1.17.0') + s.add_development_dependency('rubocop-rails', '~> 2.16.0') + s.add_development_dependency('rubocop-rake', '~> 0.6.0') s.add_development_dependency('rubocop-rspec', '~> 2.12.0') # For Documentation: From f989243e9902d1c022a34d250c1dc013396d3402 Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Fri, 20 Oct 2023 18:10:57 +0100 Subject: [PATCH 06/13] AF: Rake/Desc --- Rakefile | 5 ++-- dev_tasks/yard.rake | 28 ------------------ .../yard/default/layout/html/bubble_32x32.png | Bin 1589 -> 0 bytes dev_tasks/yard/default/layout/html/footer.erb | 5 ---- dev_tasks/yard/default/layout/html/index.erb | 1 - dev_tasks/yard/default/layout/html/layout.erb | 25 ---------------- dev_tasks/yard/default/layout/html/logo.erb | 1 - dev_tasks/yard/default/layout/html/setup.rb | 9 ------ 8 files changed, 3 insertions(+), 71 deletions(-) delete mode 100644 dev_tasks/yard.rake delete mode 100644 dev_tasks/yard/default/layout/html/bubble_32x32.png delete mode 100644 dev_tasks/yard/default/layout/html/footer.erb delete mode 100644 dev_tasks/yard/default/layout/html/index.erb delete mode 100644 dev_tasks/yard/default/layout/html/layout.erb delete mode 100644 dev_tasks/yard/default/layout/html/logo.erb delete mode 100644 dev_tasks/yard/default/layout/html/setup.rb diff --git a/Rakefile b/Rakefile index b6c5d2c4..9d9f6a76 100644 --- a/Rakefile +++ b/Rakefile @@ -34,15 +34,16 @@ namespace :test do end namespace :gemfiles do - desc 'Install dependencies for all gemfiles' + desc 'Re-install dependencies for all gemfiles' task :install do system 'bundle exec appraisal update' end + desc 'Remove all generated gemfiles' task :clean do FileUtils.rm_rf('gemfiles/*') end - desc 'Rebuild generated gemfiles and install dependencies' + desc 'Remove all generated gemfiles and re-install dependencies' task rebuild: %i[clean install] end diff --git a/dev_tasks/yard.rake b/dev_tasks/yard.rake deleted file mode 100644 index 5aa03b5e..00000000 --- a/dev_tasks/yard.rake +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -require 'yard' -require 'yard/rake/yardoc_task' - -SITE_DIR = File.expand_path("#{File.dirname(__FILE__)}/../cucumber.github.com") -API_DIR = File.join(SITE_DIR, 'api', 'cucumber-rails', 'ruby', 'yardoc') - -namespace :api do - file :dir do - raise "You need to git clone git@github.com:cucumber/cucumber.github.com.git #{SITE_DIR}" unless File.directory?(SITE_DIR) - - sh('git pull origin master') - mkdir_p API_DIR - end - - template_path = File.expand_path(File.join(File.dirname(__FILE__), 'yard')) - YARD::Templates::Engine.register_template_path(template_path) - YARD::Rake::YardocTask.new(:yard) do |yard| - dir = API_DIR - mkdir_p dir - yard.options = ['--out', dir] - end - task yard: :dir - - desc "Generate YARD docs for Cucumber-Rails' API" - task doc: :yard -end diff --git a/dev_tasks/yard/default/layout/html/bubble_32x32.png b/dev_tasks/yard/default/layout/html/bubble_32x32.png deleted file mode 100644 index 580b07818d01349103145eb3718e570ecc6b13cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1589 zcmV-52Fm$~P)00004b3#c}2nYxW zdf+Z3QSg>X@ELczyHS~kemQP z8INb?dB$(vyZ5pfH+5rsBBl9no^tUq7?d1!X#PEqH;;wQEhrW`^_3dbiqa(){%8U?`u}1=KnkF}@)101uo#K4Vo;_3d z!bp!Q;I)BW&QRZuK)f>c6Jjck-z?JzqelXkQn6>tW4toIS98+~!V%OI&r+2p8_HC1Y7KiD63q1tQbf(5@CNl8Ney}7AvEi4h24k8ht zjoBx)u?b5=paWJ5d{ZUdUI4n1BP85jq;OF(2|#>x4?qZKovpRB7({4e6S6%D9GSpb zEws7CzhbQhT4|5W3edXk|0-tz*xB=S4h+7^P~Qt}{i@A21cF@lIO)Vrno*VO#gmll zR|xeox&C7`bq%m+6EItPi%P>|d-q{_JNE;SN$hS5-ZWwrU; z=PHe9q;M(u7g+Eoah(n#y-cW=9}Wyq@~0^IQ*9jp7#ku)2PxHu#Sm9p5J08jVeH2J zpemsGncCEM+lbTgT>w~X zm?@rOIhZG=y4cQ^`Q-8SOc(p!}L zi+BsKQ(KwEk#Y89ze6gv6+x>>I5J6Gb+dQd30$WGi{Wnd91FGcgxcRcVj(aBDV+_v zjUU{?4?eBnbYh5@>S`G}t&Y`igvg2Z2NgjC7Ubi6{YBtZv^k z8_m1e)lSuDwtf^d#Z#2)mnqjTedaT}UoGDj5hZYy<2haX`uAtj?tx}%K@O*f5dc!O zp7%+c75tT(l8cL`D*QV$Qu)xd7S^Vx6UD2FK2H1PT7-FIpF3C?|3i`FOi zv#Ku}r&h5j>6~vy`ukqKFa@i_-dg1*MmvFVDa6|^9#6-|w;iBQW)Tvu)vs~Qzk+vB zMgP6nD2Lj-3bdadpax8N`9f{&;<^Un}IpVbJ00000NkvXXu0mjfC>s2~ diff --git a/dev_tasks/yard/default/layout/html/footer.erb b/dev_tasks/yard/default/layout/html/footer.erb deleted file mode 100644 index e57a0f2a..00000000 --- a/dev_tasks/yard/default/layout/html/footer.erb +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/dev_tasks/yard/default/layout/html/index.erb b/dev_tasks/yard/default/layout/html/index.erb deleted file mode 100644 index f2356c3d..00000000 --- a/dev_tasks/yard/default/layout/html/index.erb +++ /dev/null @@ -1 +0,0 @@ -<%= yieldall %> diff --git a/dev_tasks/yard/default/layout/html/layout.erb b/dev_tasks/yard/default/layout/html/layout.erb deleted file mode 100644 index 91a72c80..00000000 --- a/dev_tasks/yard/default/layout/html/layout.erb +++ /dev/null @@ -1,25 +0,0 @@ - - - - <%= erb(:headers) %> - - - - - - - - -
<%= yieldall %>
- - <%= erb(:footer) %> - - diff --git a/dev_tasks/yard/default/layout/html/logo.erb b/dev_tasks/yard/default/layout/html/logo.erb deleted file mode 100644 index e834f101..00000000 --- a/dev_tasks/yard/default/layout/html/logo.erb +++ /dev/null @@ -1 +0,0 @@ -

Cucumber-Rails <%= CUCUMBER_RAILS_VERSION %>

diff --git a/dev_tasks/yard/default/layout/html/setup.rb b/dev_tasks/yard/default/layout/html/setup.rb deleted file mode 100644 index 415999a6..00000000 --- a/dev_tasks/yard/default/layout/html/setup.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -def init - super - options[:serializer].serialize( - '/images/bubble_32x32.png', - File.read("#{File.dirname(__FILE__)}/bubble_32x32.png") - ) -end From 632557c758b5f2e01767213cf3154052791a4093 Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Mon, 23 Oct 2023 09:58:35 +0100 Subject: [PATCH 07/13] Ignore Environment Rake cop --- .rubocop.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 04f53ff4..cc57de6b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,10 @@ +inherit_from: .rubocop_todo.yml + require: - rubocop-packaging - rubocop-performance + - rubocop-rails + - rubocop-rake - rubocop-rspec AllCops: @@ -24,6 +28,10 @@ Layout/LineLength: - '^When' - '^Then' +# This cop isn't relevant for our codebase +Rails/RakeEnvironment: + Enabled: false + # This allows us to read the chmod action in a more reproducible way Style/NumericLiteralPrefix: EnforcedOctalStyle: zero_only From 99b92f916c2fb83713ed3112f833d1695db08b6d Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Mon, 23 Oct 2023 10:03:57 +0100 Subject: [PATCH 08/13] gsub_file does write to stdout or a form of it now --- lib/generators/cucumber/install_generator.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/generators/cucumber/install_generator.rb b/lib/generators/cucumber/install_generator.rb index e8b62d23..34e77a95 100644 --- a/lib/generators/cucumber/install_generator.rb +++ b/lib/generators/cucumber/install_generator.rb @@ -53,9 +53,6 @@ def create_database gsub_file 'config/database.yml', /^test:.*\n/, "test: &test\n" gsub_file 'config/database.yml', /\z/, "\ncucumber:\n <<: *test\n" - - # Since gsub_file doesn't ask the user, just inform user that the file was overwritten. - puts ' force config/database.yml' end protected From 74e5762923c4e60c71f6e14c87b2ae678a7e22a8 Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Mon, 23 Oct 2023 18:18:58 +0100 Subject: [PATCH 09/13] Update config --- .rubocop.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index cc57de6b..30ac32ca 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,3 @@ -inherit_from: .rubocop_todo.yml - require: - rubocop-packaging - rubocop-performance From 09ca931df6994b2c28a8049236ebd28f71e9a960 Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Mon, 23 Oct 2023 18:21:01 +0100 Subject: [PATCH 10/13] Partial update towards later versions of rubocop gems --- cucumber-rails.gemspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cucumber-rails.gemspec b/cucumber-rails.gemspec index 051ca539..a10bd7c7 100644 --- a/cucumber-rails.gemspec +++ b/cucumber-rails.gemspec @@ -38,10 +38,10 @@ Gem::Specification.new do |s| s.add_development_dependency('rspec', '~> 3.6') s.add_development_dependency('rubocop', '~> 1.45.0') s.add_development_dependency('rubocop-packaging', '~> 0.5.2') - s.add_development_dependency('rubocop-performance', '~> 1.17.0') - s.add_development_dependency('rubocop-rails', '~> 2.16.0') + s.add_development_dependency('rubocop-performance', '~> 1.17.1') + s.add_development_dependency('rubocop-rails', '~> 2.18.0') s.add_development_dependency('rubocop-rake', '~> 0.6.0') - s.add_development_dependency('rubocop-rspec', '~> 2.12.0') + s.add_development_dependency('rubocop-rspec', '~> 2.17.0') # For Documentation: s.add_development_dependency('yard', '~> 0.9.10') From 963b68ac272a5c785fbeb3c157121d219316d043 Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Thu, 26 Oct 2023 14:27:53 +0100 Subject: [PATCH 11/13] Fix heredoc warnings --- lib/cucumber/rails.rb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/cucumber/rails.rb b/lib/cucumber/rails.rb index 9be66ac4..bd2b7646 100644 --- a/lib/cucumber/rails.rb +++ b/lib/cucumber/rails.rb @@ -14,9 +14,12 @@ require 'rails/test_help' unless Rails.application.config.cache_classes || defined?(Spring) - warn "WARNING: You have set Rails' config.cache_classes to false - (Spring needs cache_classes set to false). This is known to cause problems - with database transactions. Set config.cache_classes to true if you want to use transactions." + warn <<~MESSAGE + WARNING: You have set Rails' config.cache_classes to false (Spring needs cache_classes set to false). + This is known to cause problems with database transactions. + + Set config.cache_classes to true if you want to use transactions. + MESSAGE end require 'cucumber/rails/world' @@ -31,8 +34,10 @@ MultiTest.disable_autorun else - warn "WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being deferred - until env.rb is called. To avoid this warning, move 'gem 'cucumber-rails', require: false' - under only group :test in your Gemfile. If already in the :test group, be sure you are - specifying 'require: false'." + warn <<~MESSAGE + WARNING: Cucumber-rails has been required outside of env.rb. The rest of loading is being deferred until env.rb is called. + + To avoid this warning, move 'gem 'cucumber-rails', require: false' under `group :test` in your Gemfile. + If it is already in the `:test` group, be sure you are specifying 'require: false'. + MESSAGE end From bd817124de6720fc50960e8f6671b2bbbe0d7e74 Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Thu, 26 Oct 2023 14:31:38 +0100 Subject: [PATCH 12/13] Fix quotes --- lib/cucumber/rails.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cucumber/rails.rb b/lib/cucumber/rails.rb index bd2b7646..858693bb 100644 --- a/lib/cucumber/rails.rb +++ b/lib/cucumber/rails.rb @@ -37,7 +37,7 @@ warn <<~MESSAGE WARNING: Cucumber-rails has been required outside of env.rb. The rest of loading is being deferred until env.rb is called. - To avoid this warning, move 'gem 'cucumber-rails', require: false' under `group :test` in your Gemfile. + To avoid this warning, move `gem 'cucumber-rails', require: false` under `group :test` in your Gemfile. If it is already in the `:test` group, be sure you are specifying 'require: false'. MESSAGE end From a8bca1ba86263722f79a5bf4532762bfe021ffbf Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Mon, 30 Oct 2023 16:39:20 +0000 Subject: [PATCH 13/13] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81cf47e0..66936f7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This file is intended to be modified using the [`changelog`](github.com/cucumber ## [Unreleased] ### Changed - Add support for Rails 7.1 [#575](https://github.com/cucumber/cucumber-rails/pull/575) +- Added new rubocop sub-gems (rails / rake) and updated versions to 2.6 ruby-conformance [#581](https://github.com/cucumber/cucumber-rails/pull/581) ### Fixed - Some of the rails 5.2 tests were installing lots of old conflicting gems ([luke-hill])