diff --git a/.rubocop.yml b/.rubocop.yml
index 04f53ff4..30ac32ca 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,6 +1,8 @@
require:
- rubocop-packaging
- rubocop-performance
+ - rubocop-rails
+ - rubocop-rake
- rubocop-rspec
AllCops:
@@ -24,6 +26,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
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])
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/cucumber-rails.gemspec b/cucumber-rails.gemspec
index eb4b6805..a10bd7c7 100644
--- a/cucumber-rails.gemspec
+++ b/cucumber-rails.gemspec
@@ -36,10 +36,12 @@ 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-packaging', '~> 0.5.1')
- s.add_development_dependency('rubocop-performance', '~> 1.17.0')
- s.add_development_dependency('rubocop-rspec', '~> 2.12.0')
+ 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.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.17.0')
# For Documentation:
s.add_development_dependency('yard', '~> 0.9.10')
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 580b0781..00000000
Binary files a/dev_tasks/yard/default/layout/html/bubble_32x32.png and /dev/null differ
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
diff --git a/lib/cucumber/rails.rb b/lib/cucumber/rails.rb
index 7722dcc3..858693bb 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
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/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
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") }