Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit fd4e761

Browse files
committed
Refactor spec to be resilient in the face of changes to :suite error handling.
1 parent ebbea9f commit fd4e761

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

spec/rspec/core/suite_hooks_spec.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,17 @@ module RSpec::Core
4141
end
4242

4343
it 'allows access to rspec-expectation methods within the hook' do
44-
RSpec.configuration.__send__(registration_method, :suite) { expect(true).to be false }
45-
expect {
44+
notified_failure = nil
45+
46+
RSpec::Support.with_failure_notifier(lambda { |e, _opts| notified_failure = e }) do
47+
RSpec.configuration.__send__(registration_method, :suite) do
48+
expect(true).to be false
49+
end
50+
4651
RSpec.configuration.with_suite_hooks { }
47-
}.to raise_error RSpec::Expectations::ExpectationNotMetError
52+
end
53+
54+
expect(notified_failure).to be_a(RSpec::Expectations::ExpectationNotMetError)
4855
end
4956

5057
context "registered on an example group" do

0 commit comments

Comments
 (0)