rspec / rspec-support

Common code needed by the other RSpec gems. Not intended for direct use.
https://rspec.info
MIT License
98 stars 103 forks source link

Fix expect_warn_deprecation matching any message #453

Closed pirj closed 3 years ago

pirj commented 3 years ago

expect_warn_deprecation matches any message when there's raise_error(RSpec::Expectations::ExpectationNotMetError) in the example, e.g.:

it 'prints a deprecation warning when given a value and negated' do
  expect_warn_deprecation(/complete nonsense/)
  expect { expect(3).not_to matcher }.to fail # where `fail` is a matcher, not Ruby's method
end

See https://github.com/rspec/rspec-support/issues/451

This depends on https://github.com/rspec/rspec-expectations/pull/1244 and https://github.com/rspec/rspec-core/pull/2802