diff --git a/.travis.yml b/.travis.yml index 7e29752bb3..0bab74f8bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ cache: directories: - ../bundle before_install: + - gem update --system # https://github.com/travis-ci/travis-ci/issues/8978#issuecomment-354036443 - unset _JAVA_OPTIONS - "script/clone_all_rspec_repos" # Note this doesn't work on JRUBY 2.0.0 mode so we don't do it, the excluded versions are broken on Ruby 2.3 @@ -21,9 +22,10 @@ rvm: - 1.9.3 - 2.0.0 - 2.1 - - 2.2.7 - - 2.3.4 - - 2.4.1 + - 2.2.9 + - 2.3.6 + - 2.4.3 + - 2.5.0 - ruby-head - ree - rbx diff --git a/Changelog.md b/Changelog.md index ff068af80e..02e778d450 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,10 @@ -### Development -[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.7.0...master) +### 3.7.1 / 2018-01-02 +[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.7.0...v3.7.1) + +Bug Fixes: + +* Work around duplicate config hook regression introduced + by Ruby 2.5's lazy proc allocation. (Myron Marston, #2497) ### 3.7.0 / 2017-10-17 [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.6.0...v3.7.0) diff --git a/appveyor.yml b/appveyor.yml index 90df32fdb8..fadbb316f3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,6 +28,9 @@ test_script: environment: matrix: - # ruby_version: '20' doesn't work for some reason - - ruby_version: '193' - - ruby_version: '21' + - ruby_version: 193 + - ruby_version: 200 + - ruby_version: 21 + - ruby_version: 22 + - ruby_version: 23-x64 + - ruby_version: 24-x64 diff --git a/lib/rspec/core/configuration.rb b/lib/rspec/core/configuration.rb index babd521b99..8cfac6236f 100644 --- a/lib/rspec/core/configuration.rb +++ b/lib/rspec/core/configuration.rb @@ -1810,6 +1810,12 @@ def before(scope=nil, *meta, &block) handle_suite_hook(scope, meta) do @before_suite_hooks << Hooks::BeforeHook.new(block, {}) end || begin + # defeat Ruby 2.5 lazy proc allocation to ensure + # the methods below are passed the same proc instances + # so `Hook` equality is preserved. For more info, see: + # https://bugs.ruby-lang.org/issues/14045#note-5 + block.__id__ + add_hook_to_existing_matching_groups(meta, scope) { |g| g.before(scope, *meta, &block) } super(scope, *meta, &block) end @@ -1833,6 +1839,12 @@ def prepend_before(scope=nil, *meta, &block) handle_suite_hook(scope, meta) do @before_suite_hooks.unshift Hooks::BeforeHook.new(block, {}) end || begin + # defeat Ruby 2.5 lazy proc allocation to ensure + # the methods below are passed the same proc instances + # so `Hook` equality is preserved. For more info, see: + # https://bugs.ruby-lang.org/issues/14045#note-5 + block.__id__ + add_hook_to_existing_matching_groups(meta, scope) { |g| g.prepend_before(scope, *meta, &block) } super(scope, *meta, &block) end @@ -1851,6 +1863,12 @@ def after(scope=nil, *meta, &block) handle_suite_hook(scope, meta) do @after_suite_hooks.unshift Hooks::AfterHook.new(block, {}) end || begin + # defeat Ruby 2.5 lazy proc allocation to ensure + # the methods below are passed the same proc instances + # so `Hook` equality is preserved. For more info, see: + # https://bugs.ruby-lang.org/issues/14045#note-5 + block.__id__ + add_hook_to_existing_matching_groups(meta, scope) { |g| g.after(scope, *meta, &block) } super(scope, *meta, &block) end @@ -1874,6 +1892,12 @@ def append_after(scope=nil, *meta, &block) handle_suite_hook(scope, meta) do @after_suite_hooks << Hooks::AfterHook.new(block, {}) end || begin + # defeat Ruby 2.5 lazy proc allocation to ensure + # the methods below are passed the same proc instances + # so `Hook` equality is preserved. For more info, see: + # https://bugs.ruby-lang.org/issues/14045#note-5 + block.__id__ + add_hook_to_existing_matching_groups(meta, scope) { |g| g.append_after(scope, *meta, &block) } super(scope, *meta, &block) end @@ -1883,6 +1907,12 @@ def append_after(scope=nil, *meta, &block) # # See {Hooks#around} for full `around` hook docs. def around(scope=nil, *meta, &block) + # defeat Ruby 2.5 lazy proc allocation to ensure + # the methods below are passed the same proc instances + # so `Hook` equality is preserved. For more info, see: + # https://bugs.ruby-lang.org/issues/14045#note-5 + block.__id__ + add_hook_to_existing_matching_groups(meta, scope) { |g| g.around(scope, *meta, &block) } super(scope, *meta, &block) end diff --git a/lib/rspec/core/version.rb b/lib/rspec/core/version.rb index 3123785b1f..e8db9f3f79 100644 --- a/lib/rspec/core/version.rb +++ b/lib/rspec/core/version.rb @@ -3,7 +3,7 @@ module Core # Version information for RSpec Core. module Version # Current version of RSpec Core, in semantic versioning format. - STRING = '3.7.0' + STRING = '3.7.1' end end end diff --git a/maintenance-branch b/maintenance-branch index 8b25206ff9..0c0f08a6d0 100644 --- a/maintenance-branch +++ b/maintenance-branch @@ -1 +1 @@ -master \ No newline at end of file +3-7-maintenance diff --git a/script/functions.sh b/script/functions.sh index b1d1866395..4ec9799660 100644 --- a/script/functions.sh +++ b/script/functions.sh @@ -83,11 +83,7 @@ function run_spec_suite_for { pushd ../$1 unset BUNDLE_GEMFILE bundle_install_flags=`cat .travis.yml | grep bundler_args | tr -d '"' | grep -o " .*"` - if is_mri_192_plus; then - travis_retry eval "RUBYOPT=$RUBYOPT:'--enable rubygems' bundle install $bundle_install_flags" - else - travis_retry eval "bundle install $bundle_install_flags" - fi + travis_retry eval "(unset RUBYOPT; exec bundle install $bundle_install_flags)" run_specs_and_record_done popd else diff --git a/spec/rspec/core/example_spec.rb b/spec/rspec/core/example_spec.rb index 8c70900e83..5bba1d5627 100644 --- a/spec/rspec/core/example_spec.rb +++ b/spec/rspec/core/example_spec.rb @@ -503,7 +503,7 @@ def expect_gc(opts) end end - it "leaves raised exceptions unmodified (GH-1103)" do + it "leaves raised exceptions unmodified (GH-1103)", :if => RUBY_VERSION < '2.5' do # set the backtrace, otherwise MRI will build a whole new object, # and thus mess with our expectations. Rubinius and JRuby are not # affected. diff --git a/spec/rspec/core/memoized_helpers_spec.rb b/spec/rspec/core/memoized_helpers_spec.rb index b4b7422773..dc2da63f82 100644 --- a/spec/rspec/core/memoized_helpers_spec.rb +++ b/spec/rspec/core/memoized_helpers_spec.rb @@ -631,7 +631,7 @@ def hello_message; "Hello from module"; end end RSpec.describe 'Module#define_method' do - it 'is still a private method' do + it 'retains its normal private visibility on Ruby versions where it is normally private', :if => RUBY_VERSION < '2.5' do a_module = Module.new expect { a_module.define_method(:name) { "implementation" } }.to raise_error NoMethodError end diff --git a/spec/rspec/core/metadata_spec.rb b/spec/rspec/core/metadata_spec.rb index 8438cfc6d6..b2a54209c4 100644 --- a/spec/rspec/core/metadata_spec.rb +++ b/spec/rspec/core/metadata_spec.rb @@ -730,10 +730,9 @@ def value_for(*args) end it 'can access the parent example group attributes via [:example_group][:example_group]' do - parent = child = nil + child = nil parent_line = __LINE__ + 1 RSpec.describe(Object, "group", :foo => 3) do - parent = metadata describe("nested") { child = metadata } end diff --git a/spec/rspec/core_spec.rb b/spec/rspec/core_spec.rb index 2141ed72ca..42bb3e844d 100644 --- a/spec/rspec/core_spec.rb +++ b/spec/rspec/core_spec.rb @@ -247,7 +247,7 @@ def reporter it 'clears the deprecation buffer' do RSpec.configuration.deprecation_stream = StringIO.new - group = RSpec.describe do + RSpec.describe do example { RSpec.deprecate("first deprecation") } end.run @@ -258,7 +258,7 @@ def reporter RSpec.configuration.deprecation_stream = StringIO.new(deprecations = "".dup) - group = RSpec.describe do + RSpec.describe do example { RSpec.deprecate("second deprecation") } end.run diff --git a/spec/support/shared_example_groups.rb b/spec/support/shared_example_groups.rb index 4a732c1baa..eb39b150a5 100644 --- a/spec/support/shared_example_groups.rb +++ b/spec/support/shared_example_groups.rb @@ -16,8 +16,8 @@ let(:project_dir) { Dir.getwd } before(:example) do - pending "Windows does not support symlinking" - end if RSpec::Support::OS.windows? + pending "Windows does not support symlinking on RUBY_VERSION < 2.3" + end if RSpec::Support::OS.windows? && RUBY_VERSION < '2.3' it "finds the files" do foos_dir = File.join(project_dir, "spec/foos")