RSpec Matchers Combinators 2 : Spec_combos Gem

I already wrote about my RSpec Matchers Combinators, I decided to extract them into the spec_combos gem.

To use it, just add the following to your Gemfile :

1
gem 'spec_combos', :group => 'test'

Compared to the first version of the matchers, I added better error messages. For example, consider the following complex nested assertion :

1
expect([1,2,3]).to all_{and_(be_odd, be_instance_of(Fixnum))}

It outputs the following error :

1
2
3
4
Failure/Error: expect([1,2,3]).to all_{and_(be_odd, be_instance_of(Fixnum))}
  expected [1, 2, 3] to all be odd and be an instance of Fixnum, but the following were not:
    [1] (2): expected 2 to be odd and be an instance of Fixnum, but:
      expected odd? to return true, got false

I hope this might help !

Comments