From 02858cb0b6f3c25350067e055ea860bc7b82baec Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Mon, 29 Jun 2020 23:31:06 +0300 Subject: [PATCH 01/21] Bump Rubies --- .travis.yml | 56 ++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index a1cc8fe9ce..c31feaff70 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,57 +38,57 @@ dist: trusty matrix: include: # Rails dev / 6 builds >= 2.4.4 - - rvm: 2.6.3 + - rvm: 2.6.6 env: RAILS_VERSION=master - - rvm: 2.5.3 + - rvm: 2.5.8 env: RAILS_VERSION=master - - rvm: 2.4.4 + - rvm: 2.4.10 env: RAILS_VERSION=master # Rails 5.2 builds >= 2.2.2 - - rvm: 2.6.3 + - rvm: 2.6.6 env: RAILS_VERSION='~> 5.2.0' - - rvm: 2.5.3 + - rvm: 2.5.8 env: RAILS_VERSION='~> 5.2.0' - - rvm: 2.4.4 + - rvm: 2.4.10 env: RAILS_VERSION='~> 5.2.0' - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION='~> 5.2.0' - rvm: 2.2.10 env: RAILS_VERSION='~> 5.2.0' # Rails 5.1 Builds >= 2.2.2 - - rvm: 2.6.3 + - rvm: 2.6.6 env: RAILS_VERSION='~> 5.1.0' - - rvm: 2.5.3 + - rvm: 2.5.8 env: RAILS_VERSION='~> 5.1.0' - - rvm: 2.4.4 + - rvm: 2.4.10 env: RAILS_VERSION='~> 5.1.0' - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION='~> 5.1.0' - rvm: 2.2.10 env: RAILS_VERSION='~> 5.1.0' # Rails 5.0 Builds >= 2.2.2 - - rvm: 2.6.3 + - rvm: 2.6.6 env: RAILS_VERSION='~> 5.0.0' - - rvm: 2.5.3 + - rvm: 2.5.8 env: RAILS_VERSION='~> 5.0.0' - - rvm: 2.4.4 + - rvm: 2.4.10 env: RAILS_VERSION='~> 5.0.0' - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION='~> 5.0.0' - rvm: 2.2.10 env: RAILS_VERSION='~> 5.0.0' # Rails 4.2 Builds >= 1.9.3 - - rvm: 2.4.4 + - rvm: 2.4.10 env: RAILS_VERSION='~> 4.2.0' - - rvm: 2.4.4 + - rvm: 2.4.10 env: RAILS_VERSION=4-2-stable - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION='~> 4.2.0' - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION=4-2-stable - rvm: 2.2.10 env: RAILS_VERSION='~> 4.2.0' @@ -108,9 +108,9 @@ matrix: env: RAILS_VERSION=4-2-stable # Rails 4.1 Builds >= 1.9.3, < 2.4 - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION='~> 4.1.0' - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION=4-1-stable - rvm: 2.2.10 env: RAILS_VERSION='~> 4.1.0' @@ -130,9 +130,9 @@ matrix: env: RAILS_VERSION=4-1-stable # Rails 4.0 Builds >= 1.8.11, < 2.4 - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION='~> 4.0.4' - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION=4-0-stable - rvm: 2.2.10 env: RAILS_VERSION='~> 4.0.4' @@ -152,9 +152,9 @@ matrix: env: RAILS_VERSION=4-0-stable # Rails 3.2 Builds < 2.4 - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION='~> 3.2.17' - - rvm: 2.3.7 + - rvm: 2.3.8 env: RAILS_VERSION=3-2-stable - rvm: 2.2.10 env: RAILS_VERSION='~> 3.2.17' @@ -202,11 +202,11 @@ matrix: env: RAILS_VERSION='~> 3.0.20' allow_failures: - - rvm: 2.6.3 + - rvm: 2.6.6 env: RAILS_VERSION=master - - rvm: 2.5.3 + - rvm: 2.5.8 env: RAILS_VERSION=master - - rvm: 2.4.4 + - rvm: 2.4.10 env: RAILS_VERSION=master fast_finish: true From 4fcdae4fc7b22f4960ad96622227fbcd0805ed1a Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Tue, 30 Jun 2020 00:18:55 +0300 Subject: [PATCH 02/21] Skip bootsnap like a no-AR app generator does --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index de4c5b3492..d2de010059 100644 --- a/Rakefile +++ b/Rakefile @@ -60,7 +60,7 @@ namespace :generate do # Rails 4 cannot use a `rails` binstub generated by Bundler sh "rm -f #{bindir}/rails" - sh "bundle exec rails new ./tmp/example_app --no-rc --skip-javascript --skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb" + sh "bundle exec rails new ./tmp/example_app --no-rc --skip-javascript --skip-bootsnap --skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb" in_example_app do sh "./travis_retry_bundle_install.sh 2>&1" From c4ff60b0bf43550450653ffeac795a644a0403f0 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Sun, 19 Jul 2020 16:12:17 +0300 Subject: [PATCH 03/21] Fix gem source mistake Could not find gem 'puma' in https://github.com/rails/rails.git (at 5-2-stable@92fd1c2). The source does not contain any versions of 'puma' --- Gemfile-rails-dependencies | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Gemfile-rails-dependencies b/Gemfile-rails-dependencies index 9d9bd20849..1639970bc7 100644 --- a/Gemfile-rails-dependencies +++ b/Gemfile-rails-dependencies @@ -26,13 +26,12 @@ when /stable$/ gem_list = %w[rails railties actionmailer actionpack activerecord activesupport] gem_list << 'activejob' if version > '4-1-stable' gem_list << 'actionview' if version > '4-0-stable' - if RUBY_VERSION >= "2.2" - gem_list << 'puma' if version > '5-0-stable' - end gem_list.each do |rails_gem| gem rails_gem, :git => "https://github.com/rails/rails.git", :branch => version end + + gem 'puma' if RUBY_VERSION >= '2.2' && version > '5-0-stable' when nil, false, "" if RUBY_VERSION < '1.9.3' # Rails 4+ requires 1.9.3+, so on earlier versions default to the last 3.x release. From c7b8a6ce7d3f892e42fb92b8967409cd61e43796 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Sun, 19 Jul 2020 19:55:08 +0300 Subject: [PATCH 04/21] Provide historical info to avoid confusion In this example, we're making sure that `view` is available in global config hooks. `group.run` accepts a reporter, but it defaults to a NullReporter anyway. --- spec/rspec/rails/example/view_example_group_spec.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spec/rspec/rails/example/view_example_group_spec.rb b/spec/rspec/rails/example/view_example_group_spec.rb index 567a56dd83..c47c7e646f 100644 --- a/spec/rspec/rails/example/view_example_group_spec.rb +++ b/spec/rspec/rails/example/view_example_group_spec.rb @@ -218,17 +218,20 @@ def controller expect(view_spec.view).to eq(view) end - it 'is accessible to hooks' do + # Regression test from rspec/rspec-rails#833 + it 'is accessible to configuration-level hooks' do with_isolated_config do run_count = 0 RSpec.configuration.before(:each, :type => :view) do - allow(view).to receive(:a_stubbed_helper) { :value } + # `view` is provided from the view example type, and serves to + # demonstrate this hook is run in the correct context. + allow(view).to receive(:render) { :value } run_count += 1 end group = RSpec::Core::ExampleGroup.describe 'a view', :type => :view do - specify { true } + specify { expect(view.render).to eq(:value) } end - group.run NullObject.new + group.run expect(run_count).to eq 1 end end From 6162f89acf8a1b77b86e613d19d4b724537ae374 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Sun, 19 Jul 2020 20:14:10 +0300 Subject: [PATCH 05/21] Make sure we use compatible i18n for old Rubies 2.2 support has been dropped from 1.5.2 https://rubygems.org/gems/i18n/versions/1.5.2 https://rubygems.org/gems/i18n/versions/1.5.1 --- Gemfile-rails-dependencies | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Gemfile-rails-dependencies b/Gemfile-rails-dependencies index 1639970bc7..3a6adbe063 100644 --- a/Gemfile-rails-dependencies +++ b/Gemfile-rails-dependencies @@ -60,5 +60,9 @@ else end end -gem "i18n", '< 0.7.0' if RUBY_VERSION < '1.9.3' +if RUBY_VERSION < '1.9.3' + gem "i18n", '< 0.7.0' +elsif RUBY_VERSION < '2.3.0' + gem "i18n", '< 1.5.2' +end gem "test-unit" if RUBY_VERSION >= '2.2.0' && version =~ /3[.-]2[.-]/ From 8075525e62a34b149b727cec0e0e22f6c5540da7 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Sun, 19 Jul 2020 21:51:08 +0300 Subject: [PATCH 06/21] Update rubygems to a newer version --- script/update_rubygems_and_install_bundler | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/update_rubygems_and_install_bundler b/script/update_rubygems_and_install_bundler index a6b4a95925..d673293da6 100755 --- a/script/update_rubygems_and_install_bundler +++ b/script/update_rubygems_and_install_bundler @@ -11,11 +11,11 @@ if is_ruby_23_plus; then yes | gem install bundler else echo "Warning installing older versions of Rubygems / Bundler" - gem update --system '2.7.8' + gem update --system '2.7.10' gem install bundler -v '1.17.3' fi else echo "Warning installing older versions of Rubygems / Bundler" - gem update --system '2.7.8' + gem update --system '2.7.10' gem install bundler -v '1.17.3' fi From 088bce92b3248b1cc5436f6aa328e6bd2dac485a Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Sun, 19 Jul 2020 22:05:34 +0300 Subject: [PATCH 07/21] Cap dependencies for 2.2.10 When installed from scratch on 2.2.10 with RubyGems 2.3.10 and Bundler 1.17.3, with RAILS_VERSION set to `5-2-stable`: childprocess-3.0.0 requires ruby version >= 2.3.0, which is incompatible with the current version, ruby 2.2.10p489 xpath-3.2.0 requires ruby version >= 2.3, which is incompatible with the current version, ruby 2.2.10p489 i18n-1.8.3 requires ruby version >= 2.3.0, which is incompatible with the current version, ruby 2.2.10p489 nio4r-2.5.2 requires ruby version >= 2.3, which is incompatible with the current version, ruby 2.2.10p489 rack-2.2.3 requires ruby version >= 2.3.0, which is incompatible with the current version, ruby 2.2.10p489 public_suffix-4.0.5 requires ruby version >= 2.3, which is incompatible with the current version, ruby 2.2.10p489 rubyzip-2.3.0 requires ruby version >= 2.4, which is incompatible with the current version, ruby 2.2.10p489 sprockets-4.0.2 requires ruby version >= 2.5.0, which is incompatible with the current version, ruby 2.2.10p489 We had sprockets capped, but only for `'~> x.x.x'`/`x.x.x` formats. --- Gemfile | 6 +++--- Gemfile-rails-dependencies | 28 +++++++++++++++++++--------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 89036e90a9..ceaca8cf86 100644 --- a/Gemfile +++ b/Gemfile @@ -79,9 +79,9 @@ end if RUBY_VERSION <= '1.8.7' # cucumber and gherkin require rubyzip as a runtime dependency on 1.8.7 # Only < 1.0 supports 1.8.7 - gem 'rubyzip', '< 1.0' -else - gem "rubyzip", '>= 1.2.2' + gem 'rubyzip', '<= 1.0' +elsif RUBY_VERSION < '2.4' + gem 'rubyzip', '>= 1.2.2', '< 2.0.0' end if RUBY_VERSION >= '2.0.0' && RUBY_VERSION < '2.2.0' diff --git a/Gemfile-rails-dependencies b/Gemfile-rails-dependencies index 3a6adbe063..217cda83d8 100644 --- a/Gemfile-rails-dependencies +++ b/Gemfile-rails-dependencies @@ -1,10 +1,5 @@ version_file = File.expand_path("../.rails-version", __FILE__) -# FIXME: rack 2.1.0 introduces a deprecation warning that rails is triggering, -# but in later versions this warning will be removed. Get rid of this hack once -# rack 2.1.0+ is out. -gem 'rack', '!= 2.1.0' - case version = ENV['RAILS_VERSION'] || (File.exist?(version_file) && File.read(version_file).chomp) || '' when /master/ gem "rails", :git => "https://github.com/rails/rails.git" @@ -49,10 +44,6 @@ else gem "puma" end - if RUBY_VERSION < "2.5" - gem "sprockets", "~> 3.0" - end - if version.gsub(/[^\d\.]/,'').to_f >= 6.0 gem "activerecord-jdbcsqlite3-adapter", "~> 60.0.rc1", :platforms => [:jruby] else @@ -60,9 +51,28 @@ else end end +gem "childprocess", '< 2.0.0' if RUBY_VERSION < '2.3' + if RUBY_VERSION < '1.9.3' gem "i18n", '< 0.7.0' elsif RUBY_VERSION < '2.3.0' gem "i18n", '< 1.5.2' end + +gem "nio4r", '< 2.4.0' if RUBY_VERSION < '2.3' + +gem "public_suffix", '< 4.0.0' if RUBY_VERSION < '2.3' + +# rack 2.1.0 introduces a deprecation warning that rails is triggering, +# but in later versions this warning is removed. +if RUBY_VERSION < '2.2' + gem "rack", '< 2.0.0', '!= 2.1.0' +elsif RUBY_VERSION < '2.3' + gem "rack", '< 2.2.0', '!= 2.1.0' +end + +gem "sprockets", '~> 3.0' if RUBY_VERSION < '2.5' + gem "test-unit" if RUBY_VERSION >= '2.2.0' && version =~ /3[.-]2[.-]/ + +gem "xpath", '< 3.2.0' if RUBY_VERSION < '2.3' From a53facbfa0dd6ae0e1e3294f1a183dd3b507a8dc Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Sun, 19 Jul 2020 23:18:20 +0300 Subject: [PATCH 08/21] Add error handling to bundler downgrade `set -e` stops the script when a *simple command* fails. If the command is part of an `||`-expression, the script continues. It seems unessential that we fail to uninstall `bundler` from the global gemset, the build is green after all. --- script/downgrade_bundler_on_old_rails | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/downgrade_bundler_on_old_rails b/script/downgrade_bundler_on_old_rails index ae59f78626..98a9585d0d 100755 --- a/script/downgrade_bundler_on_old_rails +++ b/script/downgrade_bundler_on_old_rails @@ -13,7 +13,7 @@ if ruby -e "exit(ENV['RAILS_VERSION'].scan(/\d+\.\d+.\d+/)[0].to_f < 5)"; then # this only works on Ruby 2.3 which is luckily the version we need to fix if ruby -e "exit(RUBY_VERSION.to_f == 2.3)"; then - rvm @global do gem uninstall -aIx bundler + rvm @global do gem uninstall -aIx bundler || echo "Warning: error occured removing bundler from the global RVM gemset" fi gem install bundler -v '1.17.3' From a7dd9d631ba798f4bf0a1802ead931c9ddd20d26 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Mon, 20 Jul 2020 02:07:46 +0300 Subject: [PATCH 09/21] Fix sprockets dependency actionpack was resolved to 3.2.22.5, which depends on sprockets (~> 2.2.1) --- Gemfile-rails-dependencies | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Gemfile-rails-dependencies b/Gemfile-rails-dependencies index 217cda83d8..f25331bf51 100644 --- a/Gemfile-rails-dependencies +++ b/Gemfile-rails-dependencies @@ -27,6 +27,8 @@ when /stable$/ end gem 'puma' if RUBY_VERSION >= '2.2' && version > '5-0-stable' + + gem "sprockets", '~> 3.0' if RUBY_VERSION < '2.5' && version >= '4-0-stable' when nil, false, "" if RUBY_VERSION < '1.9.3' # Rails 4+ requires 1.9.3+, so on earlier versions default to the last 3.x release. @@ -40,11 +42,15 @@ when nil, false, "" else gem "rails", version - if version >= '5-1-stable' && RUBY_VERSION >= "2.2" + major_minor_version = version.gsub(/[^\d\.]/,'').to_f + + if major_minor_version >= 5.1 && RUBY_VERSION >= "2.2" gem "puma" end - if version.gsub(/[^\d\.]/,'').to_f >= 6.0 + gem "sprockets", '~> 3.0' if RUBY_VERSION < '2.5' && major_minor_version >= 4.0 + + if major_minor_version >= 6.0 gem "activerecord-jdbcsqlite3-adapter", "~> 60.0.rc1", :platforms => [:jruby] else gem 'activerecord-jdbcsqlite3-adapter', :platforms => [:jruby] @@ -71,8 +77,6 @@ elsif RUBY_VERSION < '2.3' gem "rack", '< 2.2.0', '!= 2.1.0' end -gem "sprockets", '~> 3.0' if RUBY_VERSION < '2.5' - gem "test-unit" if RUBY_VERSION >= '2.2.0' && version =~ /3[.-]2[.-]/ gem "xpath", '< 3.2.0' if RUBY_VERSION < '2.3' From a87877e1d7b1a110edc9600667aee0b1f2f3c63f Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Mon, 20 Jul 2020 02:10:51 +0300 Subject: [PATCH 10/21] Drop invalid cop Warning: unrecognized cop BinaryOperatorParameterName found in /home/travis/build/rspec/rspec-rails/.rubocop_rspec_base.yml --- .rubocop_rspec_base.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.rubocop_rspec_base.yml b/.rubocop_rspec_base.yml index af024e8c53..81c255fe7f 100644 --- a/.rubocop_rspec_base.yml +++ b/.rubocop_rspec_base.yml @@ -69,10 +69,6 @@ LineLength: MethodLength: Max: 15 -# Who cares what we call the argument for binary operator methods? -BinaryOperatorParameterName: - Enabled: false - PercentLiteralDelimiters: PreferredDelimiters: '%': () # double-quoted string From 2b1e7fe22a364613a0da87e96acebf3ab9b08b3c Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Mon, 20 Jul 2020 02:26:11 +0300 Subject: [PATCH 11/21] Fix undefined method `to_h` for ENV --- features/support/env.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/features/support/env.rb b/features/support/env.rb index d4d96ebb81..c95769afe0 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -14,7 +14,7 @@ def run_command(cmd, timeout = nil) end def unset_bundler_env_vars - empty_env = with_environment { with_unbundled_env { ENV.to_h } } + empty_env = with_environment { with_unbundled_env { env_to_h } } aruba_env = aruba.environment.to_h (aruba_env.keys - empty_env.keys).each do |key| delete_environment_variable key @@ -31,6 +31,14 @@ def with_unbundled_env Bundler.with_clean_env { yield } end end + + def env_to_h + if RUBY_VERSION > '2.0' + ENV.to_h + else + ENV.inject({}) { |h, (k, v)| h[k] = v; h } + end + end end World(ArubaExt) From 102ba31ad482680fc761e6be18e5c6a04308d2ad Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Mon, 20 Jul 2020 02:46:35 +0300 Subject: [PATCH 12/21] Mute RuboCop offence --- lib/rspec/rails/configuration.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/rspec/rails/configuration.rb b/lib/rspec/rails/configuration.rb index 10b8e90159..b61dfbcaf1 100644 --- a/lib/rspec/rails/configuration.rb +++ b/lib/rspec/rails/configuration.rb @@ -54,7 +54,9 @@ def self.add_test_type_configurations(config) end # @private - def self.initialize_configuration(config) # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity + # rubocop:disable Style/MethodLength + # rubocop:disable Style/CyclomaticComplexity + def self.initialize_configuration(config) config.backtrace_exclusion_patterns << /vendor\// config.backtrace_exclusion_patterns << %r{lib/rspec/rails} @@ -176,6 +178,7 @@ def filter_rails_from_backtrace! end end # rubocop:enable Style/MethodLength + # rubocop:enable Style/CyclomaticComplexity initialize_configuration RSpec.configuration end From f5ebf79529db810b2feec3857fad6cf79892edbc Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Mon, 20 Jul 2020 02:46:51 +0300 Subject: [PATCH 13/21] Remove cops unknown to CI RuboCop version RucoCop on CI is fixed at 0.23, and has outdated cop names. Even without those disabling, `rubocop lib` passes just fine. --- .rubocop_rspec_base.yml | 179 ---------------------------------------- 1 file changed, 179 deletions(-) diff --git a/.rubocop_rspec_base.yml b/.rubocop_rspec_base.yml index 81c255fe7f..4af70a17fc 100644 --- a/.rubocop_rspec_base.yml +++ b/.rubocop_rspec_base.yml @@ -111,195 +111,16 @@ StringLiterals: Style/SpecialGlobalVars: Enabled: false -Style/TrailingCommaInLiteral: - Enabled: false - -Style/TrailingCommaInArguments: - Enabled: false - TrivialAccessors: AllowDSLWriters: true AllowPredicates: true ExactNameMatch: true -Style/ParallelAssignment: - Enabled: false - -Layout/EmptyLineBetweenDefs: - Enabled: false - -Layout/FirstParameterIndentation: - Enabled: false - -Naming/ConstantName: - Enabled: false - -Style/ClassCheck: - Enabled: false - -Style/ConditionalAssignment: - Enabled: false - -Style/EmptyMethod: - Enabled: false - -Style/FormatStringToken: - Enabled: false - Style/GuardClause: Enabled: false -Style/IdenticalConditionalBranches: - Enabled: false - Style/IfUnlessModifier: Enabled: false -Style/IfUnlessModifierOfIfUnless: - Enabled: false - -Style/MethodMissing: - Enabled: false - -Style/MixinUsage: - Enabled: false - -Style/MultipleComparison: - Enabled: false - -Style/MutableConstant: - Enabled: false - -Style/NestedModifier: - Enabled: false - -Style/NestedParenthesizedCalls: - Enabled: false - -Style/NumericPredicate: - Enabled: false - -Style/RedundantParentheses: - Enabled: false - -Style/StringLiteralsInInterpolation: - Enabled: false - Style/SymbolArray: Enabled: false - -Style/SymbolProc: - Enabled: false - -Style/YodaCondition: - Enabled: false - -Style/ZeroLengthPredicate: - Enabled: false - -Layout/ClosingParenthesisIndentation: - Enabled: false - -Layout/ExtraSpacing: - Enabled: false - -Layout/MultilineMethodCallBraceLayout: - Enabled: false - -Layout/MultilineMethodCallIndentation: - Enabled: false - -Layout/MultilineOperationIndentation: - Enabled: false - -Layout/SpaceAroundBlockParameters: - Enabled: false - -Layout/SpaceAroundOperators: - Enabled: false - -Layout/SpaceBeforeComma: - Enabled: false - -Style/BlockDelimiters: - Enabled: false - -Style/EmptyCaseCondition: - Enabled: false - -Style/MultilineIfModifier: - Enabled: false - -Style/RescueStandardError: - Enabled: false - -Style/StderrPuts: - Enabled: false - -Style/TernaryParentheses: - Enabled: false - -# This could likely be enabled, but it had a false positive on rspec-mocks -# (suggested change was not behaviour preserving) so I don't trust it. -Performance/HashEachMethods: - Enabled: false - -Naming/HeredocDelimiterNaming: - Enabled: false - -Layout/EmptyLineAfterMagicComment: - Enabled: false - -Layout/IndentArray: - Enabled: false - -Layout/IndentAssignment: - Enabled: false - -Layout/IndentHeredoc: - Enabled: false - -Layout/SpaceInsidePercentLiteralDelimiters: - Enabled: false - -Style/EmptyElse: - Enabled: false - -Style/IfInsideElse: - Enabled: false - -Style/RedundantReturn: - Enabled: false - -Style/StructInheritance: - Enabled: false - -Naming/VariableNumber: - Enabled: false - -Layout/SpaceInsideStringInterpolation: - Enabled: false - -Style/DateTime: - Enabled: false - -Style/ParenthesesAroundCondition: - Enabled: false - -Layout/EmptyLinesAroundBlockBody: - Enabled: false - -Lint/ImplicitStringConcatenation: - Enabled: false - -Lint/NestedMethodDefinition: - Enabled: false - -Style/RegexpLiteral: - Enabled: false - -Style/TrailingUnderscoreVariable: - Enabled: false - -Layout/EmptyLinesAroundAccessModifier: - Enabled: false From bed4459833d8fac7d59b5187feee07315e1ae77a Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Mon, 20 Jul 2020 10:21:14 +0300 Subject: [PATCH 14/21] Fix install-time gem version incompatibilities Gem::RuntimeRequirementNotMetError: public_suffix requires Ruby version >= 1.9.3. The current ruby version is 1.8. An error occurred while installing public_suffix (1.4.2), and Bundler cannot continue. Gem::RuntimeRequirementNotMetError: redcarpet requires Ruby version >= 1.9.2. The current ruby version is 1.8. An error occurred while installing redcarpet (3.1.1), and Bundler cannot continue. Gem::RuntimeRequirementNotMetError: rubyzip requires Ruby version >= 1.9.2. The current ruby version is 1.8. An error occurred while installing rubyzip (1.0.0), and Bundler cannot continue. --- Gemfile | 6 +++--- Gemfile-rails-dependencies | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index ceaca8cf86..e808649e1a 100644 --- a/Gemfile +++ b/Gemfile @@ -11,9 +11,9 @@ gem 'yard', '~> 0.9.24', :require => false ### deps for rdoc.info group :documentation do - gem 'redcarpet' - gem 'github-markup' if RUBY_VERSION > '2.0.0' + gem 'redcarpet' + gem 'github-markup' gem 'relish' end end @@ -79,7 +79,7 @@ end if RUBY_VERSION <= '1.8.7' # cucumber and gherkin require rubyzip as a runtime dependency on 1.8.7 # Only < 1.0 supports 1.8.7 - gem 'rubyzip', '<= 1.0' + gem 'rubyzip', '< 1.0' elsif RUBY_VERSION < '2.4' gem 'rubyzip', '>= 1.2.2', '< 2.0.0' end diff --git a/Gemfile-rails-dependencies b/Gemfile-rails-dependencies index f25331bf51..a952cda6d0 100644 --- a/Gemfile-rails-dependencies +++ b/Gemfile-rails-dependencies @@ -67,7 +67,15 @@ end gem "nio4r", '< 2.4.0' if RUBY_VERSION < '2.3' -gem "public_suffix", '< 4.0.0' if RUBY_VERSION < '2.3' +if RUBY_VERSION < '1.9.3' + gem "public_suffix", '< 1.4.0' +elsif RUBY_VERSION < '2.0' + gem "public_suffix", '< 2.0.0' +elsif RUBY_VERSION < '2.1' + gem "public_suffix", '< 3.0.0' +elsif RUBY_VERSION < '2.3' + gem "public_suffix", '< 4.0.0' +end # rack 2.1.0 introduces a deprecation warning that rails is triggering, # but in later versions this warning is removed. From 89dd9ece5742540521d89ea9cecf1839aae8bfc3 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Mon, 20 Jul 2020 10:59:32 +0300 Subject: [PATCH 15/21] Backport skipping of a spec due to Rails bug Update to the latest released Rails 5.2.4.3 didn't help, it still has the bug. Backported from https://github.com/rspec/rspec-rails/blob/c0a8c22186a1232e3b1612c44bc88052ec56c945/spec/rspec/rails/example/view_example_group_spec.rb#L239 --- spec/rspec/rails/example/view_example_group_spec.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/spec/rspec/rails/example/view_example_group_spec.rb b/spec/rspec/rails/example/view_example_group_spec.rb index c47c7e646f..b2d1a820d5 100644 --- a/spec/rspec/rails/example/view_example_group_spec.rb +++ b/spec/rspec/rails/example/view_example_group_spec.rb @@ -218,8 +218,19 @@ def controller expect(view_spec.view).to eq(view) end + if RUBY_VERSION <= "2.3.0" && ENV["RAILS_VERSION"] !~ /stable/ && ::Rails.version.to_f == 5.2 + pending_only_on_ruby_22_rails_52 = """ + Rails 5.2.4.2 has a syntax error in ActionDispatch::Request::Session. + (A &. usage which does not work in 2.2.10) + It has been fixed but not released, this spec will not pass until that + has been released. + """ + else + pending_only_on_ruby_22_rails_52 = false + end + # Regression test from rspec/rspec-rails#833 - it 'is accessible to configuration-level hooks' do + it 'is accessible to configuration-level hooks', :pending => pending_only_on_ruby_22_rails_52 do with_isolated_config do run_count = 0 RSpec.configuration.before(:each, :type => :view) do From 6a8fd077f14c791a7ef39f596735a7d867335a9e Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Mon, 20 Jul 2020 12:40:51 +0300 Subject: [PATCH 16/21] Test a stable version of Rails 5.2 with Ruby 2.2 For the reasons described in the comment --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c31feaff70..a0b8f24f9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,11 @@ matrix: - rvm: 2.3.8 env: RAILS_VERSION='~> 5.2.0' - rvm: 2.2.10 - env: RAILS_VERSION='~> 5.2.0' + # An incompatibility with Ruby 2.2 in Rails 5.2.4.0 (still not fixed 5.2.4.3) + # prevents from testing against this combination. This bug is not in 5-2-stable: + # lib/action_dispatch/request/session.rb:96: syntax error, unexpected '.' + # id&.public_id + env: RAILS_VERSION='5-2-stable' # Rails 5.1 Builds >= 2.2.2 - rvm: 2.6.6 From 0a3703ec6fa8968effaeb7d65dac4a19758198f9 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Mon, 20 Jul 2020 18:08:27 +0300 Subject: [PATCH 17/21] Avoid spring to be bundled bundle exec rails new ./tmp/example_app --no-rc --skip-javascript --skip-bootsnap --skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb Gem::RuntimeRequirementNotMetError: spring requires Ruby version >= 2.4.0. The current ruby version is 2.3.0. An error occurred while installing spring (2.1.0), and Bundler cannot continue. --- Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index d2de010059..bd15a19681 100644 --- a/Rakefile +++ b/Rakefile @@ -60,7 +60,7 @@ namespace :generate do # Rails 4 cannot use a `rails` binstub generated by Bundler sh "rm -f #{bindir}/rails" - sh "bundle exec rails new ./tmp/example_app --no-rc --skip-javascript --skip-bootsnap --skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb" + sh "bundle exec rails new ./tmp/example_app --no-rc --skip-javascript --skip-bootsnap --skip-sprockets --skip-spring --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb" in_example_app do sh "./travis_retry_bundle_install.sh 2>&1" @@ -183,7 +183,7 @@ namespace :no_active_record do # Rails 4 cannot use a `rails` binstub generated by Bundler sh "rm -f #{bindir}/rails" - sh "bundle exec rails new #{example_app_dir} --no-rc --skip-active-record --skip-javascript --skip-bootsnap --skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb" + sh "bundle exec rails new #{example_app_dir} --no-rc --skip-active-record --skip-javascript --skip-bootsnap --skip-sprockets --skip-spring --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb" in_example_app(:app_dir => example_app_dir) do sh "./travis_retry_bundle_install.sh 2>&1" From 6e6a144e526c3a2fcd83476a4bd764b318c070ec Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Mon, 20 Jul 2020 19:05:13 +0300 Subject: [PATCH 18/21] Cap Aruba and ffi to resolve version conflicts ffi has strict Ruby constraints aruba: Bundler could not find compatible versions for gem "thor": In Gemfile: aruba (~> 0.14.11) was resolved to 0.14.12, which depends on thor (~> 0.19) rails (~> 3.1.12) was resolved to 3.1.12, which depends on railties (= 3.1.12) was resolved to 3.1.12, which depends on thor (~> 0.14.6) --- Gemfile | 6 ++++-- rspec-rails.gemspec | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index e808649e1a..98cf5e9dfc 100644 --- a/Gemfile +++ b/Gemfile @@ -30,8 +30,10 @@ end if RUBY_VERSION < '1.9' gem 'ffi', '< 1.9.19' # ffi dropped Ruby 1.8 support in 1.9.19 -else - gem 'ffi', '~> 1.9.25' +elsif RUBY_VERSION < '2.0' + gem 'ffi', '< 1.11.0' # ffi dropped Ruby 2.0 support in 1.11.0 +elsif RUBY_VERSION < '2.3' + gem 'ffi', '< 1.13.0' end if RUBY_VERSION >= '2.0.0' diff --git a/rspec-rails.gemspec b/rspec-rails.gemspec index d9ef49b90a..c04f956a6e 100644 --- a/rspec-rails.gemspec +++ b/rspec-rails.gemspec @@ -51,6 +51,11 @@ Gem::Specification.new do |s| end s.add_development_dependency 'cucumber', '~> 1.3.5' - s.add_development_dependency 'aruba', '~> 0.14.12' + if ENV['RAILS_VERSION'].gsub(/[^\d\.-]/, '').tr('-', '.') < '4.0' + # aruba > 0.9 depends on thor ~> 0.19, while railties < 4.0 depend on thor ~> 0.14.6 + s.add_development_dependency 'aruba', '~> 0.8.1' + else + s.add_development_dependency 'aruba', '~> 0.14.12' + end s.add_development_dependency 'ammeter', '~> 1.1.2' end From 5781ea1be5c474d6cd47bb2a9d12d106044c7e57 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Tue, 21 Jul 2020 20:57:40 +0300 Subject: [PATCH 19/21] Use the previous aruba for older Rails https://github.com/rspec/rspec-rails/pull/2140/files#diff-73c25cf975ccb4c89d8659202506c353L58 bumped aruba from 0.5.4 straight to 0.14.12. Using the version that used to work for older rails. --- features/support/env.rb | 42 ++++++++++++++++++++++++++++++----------- rspec-rails.gemspec | 2 +- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/features/support/env.rb b/features/support/env.rb index c95769afe0..ba56a9a4eb 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -2,13 +2,27 @@ require 'fileutils' module ArubaExt - def run_command(cmd, timeout = nil) - exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd - unset_bundler_env_vars - # Ensure the correct Gemfile and binstubs are found - in_current_directory do - with_unbundled_env do - super(exec_cmd, timeout) + if defined?(Aruba::VERSION) && Aruba::VERSION >= '0.14.12' + def run_command(cmd, timeout = nil) + exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd + unset_bundler_env_vars + # Ensure the correct Gemfile and binstubs are found + in_current_directory do + with_unbundled_env do + super(exec_cmd, timeout) + end + end + end + else + def run(cmd, timeout = nil) + exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd + super(exec_cmd, timeout) + end + # This method overrides Aruba 0.5.4 implementation so that we can reset Bundler to use the sample app Gemfile + def in_current_dir(&block) + Bundler.with_clean_env do + _mkdir(current_dir) + Dir.chdir(current_dir, &block) end end end @@ -41,12 +55,18 @@ def env_to_h end end -World(ArubaExt) - -Aruba.configure do |config| - config.exit_timeout = 30 +if defined?(Aruba::VERSION) && Aruba::VERSION >= '0.14.12' + Aruba.configure do |config| + config.exit_timeout = 30 + end +else + Before do + @aruba_timeout_seconds = 30 + end end +World(ArubaExt) + unless File.directory?('./tmp/example_app') system "rake generate:app generate:stuff" end diff --git a/rspec-rails.gemspec b/rspec-rails.gemspec index c04f956a6e..162685cb97 100644 --- a/rspec-rails.gemspec +++ b/rspec-rails.gemspec @@ -53,7 +53,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'cucumber', '~> 1.3.5' if ENV['RAILS_VERSION'].gsub(/[^\d\.-]/, '').tr('-', '.') < '4.0' # aruba > 0.9 depends on thor ~> 0.19, while railties < 4.0 depend on thor ~> 0.14.6 - s.add_development_dependency 'aruba', '~> 0.8.1' + s.add_development_dependency 'aruba', '~> 0.5.4' else s.add_development_dependency 'aruba', '~> 0.14.12' end From a8dd5e1764b7142e67dc7903842f332e1a4a7daa Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Wed, 22 Jul 2020 10:41:11 +0300 Subject: [PATCH 20/21] Add 5-2-stable Ruby 2.2 build to allowed failures There's a minor difference: Widget management User creates a new widget -1 example, 0 failures, 1 pending +1 example, 0 failures most probably caused by 5-2-stable vs 5.2.4.x spec generation difference. --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index a0b8f24f9b..40b827eea8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -212,6 +212,11 @@ matrix: env: RAILS_VERSION=master - rvm: 2.4.10 env: RAILS_VERSION=master + - rvm: 2.2.10 + # An actual incompatibility of 5.2.4.0-5.2.4.3 forces to use `5-2-stable`, + # but there's a minor difference in the generated tests that results in a + # minor failure. + env: RAILS_VERSION='5-2-stable' fast_finish: true branches: From 1dcff41ca59f2bb980127b8e838710d66dbf76c3 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Tue, 28 Jul 2020 15:47:42 +0300 Subject: [PATCH 21/21] Clarify why a specific version of Aruba is used Co-authored-by: Jon Rowe --- rspec-rails.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rspec-rails.gemspec b/rspec-rails.gemspec index 162685cb97..e57043bdbc 100644 --- a/rspec-rails.gemspec +++ b/rspec-rails.gemspec @@ -52,7 +52,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'cucumber', '~> 1.3.5' if ENV['RAILS_VERSION'].gsub(/[^\d\.-]/, '').tr('-', '.') < '4.0' - # aruba > 0.9 depends on thor ~> 0.19, while railties < 4.0 depend on thor ~> 0.14.6 + # We use aruba `~> 0.5.4` as the last known working version and later versions (> 0.9) depend on thor ~> 0.19, which is incompatible with railties < 4.0. s.add_development_dependency 'aruba', '~> 0.5.4' else s.add_development_dependency 'aruba', '~> 0.14.12'