diff --git a/Changelog.md b/Changelog.md index 2e26b72581..76683ddc13 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,15 @@ +### 3.2.3 / 2015-04-06 +[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.2.2...v3.2.3) + +Bug Fixes: + +* Fix how the DSL methods are defined so that RSpec is compatible with + gems that define methods of the same name on `Kernel` (such as + the `its-it` gem). (Alex Kwiatkowski, Ryan Ong, #1907) +* Fix `before(:context) { skip }` so that it does not wrongly cause the + spec suite to exit with a non-zero status when no examples failed. + (Myron Marston, #1926) + ### 3.2.2 / 2015-03-11 [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.2.1...v3.2.2) @@ -61,6 +73,13 @@ Enhancements: * Make `-I` option support multiple values when separated by `File::PATH_SEPARATOR`, such as `rspec -I foo:bar`. This matches the behavior of Ruby's `-I` option. (Fumiaki Matsushima, #1855). +* Treat each example as having a singleton example group for the + purposes of applying metadata-based features that normally apply + to example groups to individually tagged examples. For example, + `RSpec.shared_context "Uses redis", :uses_redis` will now apply + to individual examples tagged with `:uses_redis`, as will + `config.include RedisHelpers, :uses_redis`, and + `config.before(:context, :uses_redis) { }`, etc. (Myron Marston, #1749) Bug Fixes: diff --git a/lib/rspec/core/example_group.rb b/lib/rspec/core/example_group.rb index 1738de33a9..7b0dada362 100644 --- a/lib/rspec/core/example_group.rb +++ b/lib/rspec/core/example_group.rb @@ -35,7 +35,7 @@ class ExampleGroup # @private def self.idempotently_define_singleton_method(name, &definition) (class << self; self; end).module_exec do - remove_method(name) if method_defined?(name) + remove_method(name) if method_defined?(name) && instance_method(name).owner == self define_method(name, &definition) end end @@ -514,6 +514,7 @@ def self.run(reporter=RSpec::Core::NullReporter.new) result_for_this_group && results_for_descendants rescue Pending::SkipDeclaredInExample => ex for_filtered_examples(reporter) { |example| example.skip_with_exception(reporter, ex) } + true rescue Exception => ex RSpec.world.wants_to_quit = true if fail_fast? for_filtered_examples(reporter) { |example| example.fail_with_exception(reporter, ex) } diff --git a/lib/rspec/core/version.rb b/lib/rspec/core/version.rb index 095c8588ab..039f36ea22 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.2.2' + STRING = '3.2.3' end end end diff --git a/spec/rspec/core/example_spec.rb b/spec/rspec/core/example_spec.rb index 7fa62cba8a..4dca4c1542 100644 --- a/spec/rspec/core/example_spec.rb +++ b/spec/rspec/core/example_spec.rb @@ -637,7 +637,7 @@ def expect_pending_result(example) example {} example {} end - group.run + expect(group.run).to be true expect(group.examples.first).to be_skipped_with("not done") expect(group.examples.last).to be_skipped_with("not done") end diff --git a/spec/rspec/core_spec.rb b/spec/rspec/core_spec.rb index a367e92bc8..fd818f7a6a 100644 --- a/spec/rspec/core_spec.rb +++ b/spec/rspec/core_spec.rb @@ -204,5 +204,14 @@ RSpec::NotAConst }.to raise_error(NameError, /RSpec::NotAConst/) end + + it "does not blow up if some gem defines `Kernel#it`", :slow do + code = 'Kernel.module_eval { def it(*); end }; require "rspec/core"' + out, err, status = run_ruby_with_current_load_path(code) + + expect(err).to eq("") + expect(out).to eq("") + expect(status.exitstatus).to eq(0) + end end