rspec-given icon indicating copy to clipboard operation
rspec-given copied to clipboard

Bug fix for `have_failed` with RSpec 3.0.0

Open ronen opened this issue 11 years ago • 4 comments

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.)

ronen avatar Jun 05 '14 23:06 ronen

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

searls avatar Jan 09 '15 14:01 searls

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...

ronen avatar Jan 09 '15 14:01 ronen

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

searls avatar Jan 09 '15 14:01 searls

Cool, glad you're on top of it.

ronen avatar Jan 09 '15 15:01 ronen