jimweirich / rspec-given

Given/When/Then keywords for RSpec Specifications
https://github.com/jimweirich/rspec-given
MIT License
653 stars 61 forks source link

Bug fix for `have_failed` with RSpec 3.0.0 #43

Open ronen opened 10 years ago

ronen commented 10 years ago

With Mr. Weirich sadly no longer with us, I don't know who if anyone wil be maintaing this, but I figure I may as well at least post the issue/PR in case anybody else comes across the same issue.

With the release of RSpec 3.0.0, the have_failed mechanism no longer works. Attempting:

  When(:result) { stack.pop }
  Then { expect(result).to have_failed(UnderflowError, /empty/) }

Results in an error like:

 Failure/Error: Then { expect(credentials).to have_failed UnderflowError }
    expected UnderFlowError but was not given a block

This PR should fix that.

(The specific RSpec change that caused this to break was rspec/rspec-expections@79582c2, which cleaned up the delineation between blocks and values for expect { } vs expect() as per rspec/rspec-expectations#526 ; unfortunately rspec-given was relying on the previous looseness to be able to use a value that quacked like a Proc.)

searls commented 9 years ago

Hey ronen — I'm going to take a look at this branch today. Do you think it's ready to merge into rspec-given's new repo? https://github.com/rspec-given/rspec-given

ronen commented 9 years ago

hey justin -- glad to see you've taken on this gem!

Do you think it's ready to merge into rspec-given's new repo? https://github.com/rspec-given/rspec-given

hmm.... no idea... i haven't thought about this issue or looked at any of the repos since i submitted the PR...

searls commented 9 years ago

No worries. Fortunately there were tests broken by your issue and this patch fixes several of them. I'm digging into it now and I think I understand the RSpec API change that caused the issue. I've already merged your patch into my PR and you'll get the credit :D

ronen commented 9 years ago

Cool, glad you're on top of it.