What is the correct format for using shoulda-matchers and RSpec\'s new expect syntax?
I'll suplement the answer of @peter-alfvin. In case you test the model and its migration themselves with shoulda-matchers
you can't use :expect
outside of it
block, so can't write:
RSpec.describe ModelName, type: :model do
expect(subject).to belong_to(:user)
end
And you will get the expection:
`expect` is not available on an example group (e.g. a `describe` or `context` block).
but correct version is:
RSpec.describe ModelName, type: :model do
it { expect(subject).to belong_to(:user) }
end