Reputation: 171
I have a rails 4 validation for my User model:
has_many :items, -> { order(:position) }
I expected the following shoulda matcher to work:
it {should have_many(:items).order(:position)}
But it raises this error:
Expected User to have a has_many association called items (items should be ordered by position)
Is my syntax wrong for the test?
Upvotes: 4
Views: 1347
Reputation: 2344
There was a bug in v2.4.0 where this didn't work. This has been fixed in v2.5.0, so check it out!
See here for more: https://github.com/thoughtbot/shoulda-matchers/issues/388
Upvotes: 3