Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3: rubocop update #581

Merged
merged 13 commits into from
Oct 31, 2023
Merged
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require:
- rubocop-packaging
- rubocop-performance
- rubocop-rails
- rubocop-rake
- rubocop-rspec

AllCops:
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
5 changes: 3 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 6 additions & 4 deletions cucumber-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
28 changes: 0 additions & 28 deletions dev_tasks/yard.rake

This file was deleted.

Binary file removed dev_tasks/yard/default/layout/html/bubble_32x32.png
Binary file not shown.
5 changes: 0 additions & 5 deletions dev_tasks/yard/default/layout/html/footer.erb

This file was deleted.

1 change: 0 additions & 1 deletion dev_tasks/yard/default/layout/html/index.erb

This file was deleted.

25 changes: 0 additions & 25 deletions dev_tasks/yard/default/layout/html/layout.erb

This file was deleted.

1 change: 0 additions & 1 deletion dev_tasks/yard/default/layout/html/logo.erb

This file was deleted.

9 changes: 0 additions & 9 deletions dev_tasks/yard/default/layout/html/setup.rb

This file was deleted.

19 changes: 12 additions & 7 deletions lib/cucumber/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
4 changes: 2 additions & 2 deletions lib/cucumber/rails/capybara/javascript_emulation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/cucumber/rails/capybara/select_dates_and_times.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion lib/cucumber/rails/hooks/mail.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

if defined?(::ActionMailer)
if defined?(ActionMailer)
Before do
ActionMailer::Base.deliveries = []
end
Expand Down
3 changes: 0 additions & 3 deletions lib/generators/cucumber/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/generators/cucumber/install_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand Down