4

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?

1 Answers1

3

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

Elliot Winkler
  • 2,336
  • 20
  • 17