rspec/rspec-collection_matchers — pull request #15 by myronmarston (2014-04-22 18:00:21+00:00)
Title: Import rspec rails extensions

This is related to rspec/rspec-rails#1003.

I've cleaned things up a bit here (no more monkey patching itself) and ported over the `errors_on` extension to ActiveModel from rspec-rails:

https://github.com/rspec/rspec-rails/blob/98398d5127da1f98065b1eee032c827a011eb128/lib/rspec/rails/extensions/active_record/base.rb#L33-L58

I was also planning to port over the `records` extension in that file, but I think it's actually not needed. I was trying to find the specs for it in rspec-rails, and found the cuke:

https://github.com/rspec/rspec-rails/blob/98398d5127da1f98065b1eee032c827a011eb128/features/model_specs/records.feature

...but when I removed the file that defines `records` and ran that cuke, it still passed. I think it works because AR implements `count` and `size`, and the matcher treats `records` as syntactic sugar rather than a method to call, and it still works. I confirmed this by changing the cuke to use `have(1).rec` and `have(0).recs` and it still passed. So, I think the `records` extension is completely unnecessary.

/cc @JonRowe @cupakromer @hugobarauna @alindeman