I've recently discovered compound expectations in RSpec 3, which I really like, but I noticed a difference in output if you use them within a custom matcher. For example:
RSpec::Matchers.define :be_acceptable do match do |actual| expect(actual).to be_even.and be > 10 end end describe "Composing matchers" do it "works in an expectation" do expect(1).to be_even.and be > 10 end it "works inside another matcher" do expect(1).to be_acceptable end end Both expectations work, but the second loses the detailed failure information: Failure/Error: expect(1).to be_even.and be > 10 expected `1.even?` to return true, got false ...and: expected: > 10 got: 1 Failure/Error: expect(1).to be_acceptable expected 1 to be acceptable Is there a way to encapsulate a set of other matchers inside another matcher, while retaining the full failure messages? Thanks, Kerry -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to rspec+unsubscr...@googlegroups.com. To post to this group, send email to rspec@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/4a6ce1d8-c53d-4f95-9ab3-114664d23828%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.