Closed pirj closed 3 years ago
The use of non-nested expectation resolves the issue:
expect(RSpec.configuration.reporter).to
receive(:deprecation).with(include(message: match(/Tahe/)))
just for the reference, original implementation:
def expect_warn_deprecation(snippet=//)
expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
message = options[:message]
expect(message).to match(snippet)
end
end
That approach looks reasonable, is there a PR?
There are no tests for the whole file, it's tricky to write, takes me a while. Since we're nearing that moment when deprecation messages are becoming extremely important to properly cover, I'll handle this ASAP.
I fail to write a test that would fail for the current implementation 😬 Would you accept such a PR?
Along the way I discovered that
around { |example| in_sub_process { example.run } }
doesn't work, marks all examples as pending.
Subject of the issue
expect_warn_deprecation
matches any message when there'sraise_error(RSpec::Expectations::ExpectationNotMetError)
in the example. Might affect other rspec-support deprecation matcher helpers.Your environment
Steps to reproduce
Original code:
Simplification:
Expected behavior
or
Actual behavior
:aggregate_failures
fixes the issue with the first expectation, it is now printed, but now the inner failure is propagated.