Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix expect_warn_deprecation matching any message #452

Merged
merged 1 commit into from
Dec 18, 2020

Conversation

pirj
Copy link
Member

@pirj pirj commented Dec 15, 2020

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
end

fixes: #451

I'm sending against main, but it needs to be merged to 4-0-dev as well.

@pirj pirj self-assigned this Dec 15, 2020
@pirj pirj force-pushed the fix-deprecation-helpers branch 2 times, most recently from 62c9179 to 6687069 Compare December 15, 2020 14:55
@pirj
Copy link
Member Author

pirj commented Dec 15, 2020

       -["include {:message => (match /The #<Class:0x00005577a8117798> formatter uses the deprecated formatter interface/), :call_site => (include \"/home/runner/work/rspec-support/rspec-core/spec/rspec/core/formatters_spec.rb:88\")}"]
       +[{:message=>
       +   " The #<Class:0x00005577a8117798> formatter uses the deprecated formatter interface not supported directly by RSpec 3.  To continue to use this formatter you must install the `rspec-legacy_formatters` gem, which provides support for legacy formatters or upgrade the formatter to a compatible version.  Formatter added at: /home/runner/work/rspec-support/rspec-core/spec/rspec/core/formatters_spec.rb:88:in `block (4 levels) in <module:Formatters>'\n"}]

Seems like one legitimate failure has been found.

@JonRowe
Copy link
Member

JonRowe commented Dec 16, 2020

I kicked the build over but its still failing, so it looks like it wasn't enough?

@pirj
Copy link
Member Author

pirj commented Dec 16, 2020

Yep, rspec-mocks rspec-expectations this time. Will send out a fix.

pirj added a commit to rspec/rspec-expectations that referenced this pull request Dec 17, 2020
        -["include {:message => (match /legacy\\s+RSpec\\s+matcher/), :call_site => (include \"/home/runner/work/rspec-support/rspec-expectations/spec/rspec/matchers/legacy_spec.rb:31\")}"]
       +[{:message=>
       +   "#<#<Class:0x000055fcd6e44840>:0x000055fcd6e52bc0> implements a legacy RSpec matcher\nprotocol. For the current protocol you should expose the failure messages\nvia the `failure_message` and `failure_message_when_negated` methods.\n(Used from /home/runner/work/rspec-support/rspec-expectations/spec/rspec/matchers/legacy_spec.rb:31:in `block (4 levels) in <module:Matchers>')\n",
       +  :type=>"legacy_matcher"}]

See rspec/rspec-support#452
@JonRowe
Copy link
Member

JonRowe commented Dec 17, 2020

Build kicked over again

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
    end
@pirj
Copy link
Member Author

pirj commented Dec 17, 2020

Green.

@pirj
Copy link
Member Author

pirj commented Dec 17, 2020

Not so sure about 1.8.7 and co though.

@JonRowe JonRowe merged commit b3a075a into main Dec 18, 2020
@JonRowe JonRowe deleted the fix-deprecation-helpers branch December 18, 2020 09:32
@JonRowe
Copy link
Member

JonRowe commented Dec 18, 2020

The travis builds have gotten even more broken 😂 I'm going to have to look at that this weekend

pirj added a commit to rspec/rspec-expectations that referenced this pull request Dec 18, 2020
        -["include {:message => (match /legacy\\s+RSpec\\s+matcher/), :call_site => (include \"/home/runner/work/rspec-support/rspec-expectations/spec/rspec/matchers/legacy_spec.rb:31\")}"]
       +[{:message=>
       +   "#<#<Class:0x000055fcd6e44840>:0x000055fcd6e52bc0> implements a legacy RSpec matcher\nprotocol. For the current protocol you should expose the failure messages\nvia the `failure_message` and `failure_message_when_negated` methods.\n(Used from /home/runner/work/rspec-support/rspec-expectations/spec/rspec/matchers/legacy_spec.rb:31:in `block (4 levels) in <module:Matchers>')\n",
       +  :type=>"legacy_matcher"}]

See rspec/rspec-support#452
JonRowe added a commit that referenced this pull request Dec 27, 2020
Fix expect_warn_deprecation matching any message
yujinakayama pushed a commit to yujinakayama/rspec-monorepo that referenced this pull request Oct 6, 2021
        -["include {:message => (match /legacy\\s+RSpec\\s+matcher/), :call_site => (include \"/home/runner/work/rspec-support/rspec-expectations/spec/rspec/matchers/legacy_spec.rb:31\")}"]
       +[{:message=>
       +   "#<#<Class:0x000055fcd6e44840>:0x000055fcd6e52bc0> implements a legacy RSpec matcher\nprotocol. For the current protocol you should expose the failure messages\nvia the `failure_message` and `failure_message_when_negated` methods.\n(Used from /home/runner/work/rspec-support/rspec-expectations/spec/rspec/matchers/legacy_spec.rb:31:in `block (4 levels) in <module:Matchers>')\n",
       +  :type=>"legacy_matcher"}]

See rspec/rspec-support#452

---
This commit was imported from rspec/rspec-expectations@f1a1e7a.
yujinakayama pushed a commit to yujinakayama/rspec-monorepo that referenced this pull request Oct 6, 2021
…eprecation-helpers

Fix expect_warn_deprecation matching any message

---
This commit was imported from rspec/rspec-support@b3a075a.
yujinakayama pushed a commit to yujinakayama/rspec-monorepo that referenced this pull request Oct 6, 2021
…eprecation-helpers

Fix expect_warn_deprecation matching any message

---
This commit was imported from rspec/rspec-support@d69dd88.
yujinakayama pushed a commit to yujinakayama/rspec-monorepo that referenced this pull request Oct 19, 2021
        -["include {:message => (match /legacy\\s+RSpec\\s+matcher/), :call_site => (include \"/home/runner/work/rspec-support/rspec-expectations/spec/rspec/matchers/legacy_spec.rb:31\")}"]
       +[{:message=>
       +   "#<#<Class:0x000055fcd6e44840>:0x000055fcd6e52bc0> implements a legacy RSpec matcher\nprotocol. For the current protocol you should expose the failure messages\nvia the `failure_message` and `failure_message_when_negated` methods.\n(Used from /home/runner/work/rspec-support/rspec-expectations/spec/rspec/matchers/legacy_spec.rb:31:in `block (4 levels) in <module:Matchers>')\n",
       +  :type=>"legacy_matcher"}]

See rspec/rspec-support#452

---
This commit was imported from rspec/rspec-expectations@216db53.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internal affairs: expect_warn_deprecation matches any message when there's fail in the example
2 participants