I know that this question exists, but the answers didn't help me.
Working with the Participant Model, which
belongs_to :game
belongs_to :team
The shoulda-matcher code that I need to work is
it {should validate_uniqueness_of(:team).scoped_to(:game)
The code in my Participant Model is
validates :team, presence: true, uniqueness: {scope: :game}
I have tried to follow the answers at the above question and the solutions on the git hub itself for this known issue, and gotten no luck.
If I just leave it 'clean' I get this error:
Failure/Error: it {should validate_uniqueness_of(:team).scoped_to(:game)}
ActiveRecord::AssociationTypeMismatch:
Team(#70267561823460) expected, got String(#70267552833620)
To complicate things just a little, Team belongs_to :division
I'm using rspec and rails 5. Is there an answer within shoulda-matchers is the question?
To answer the first question - I haven't tried it in the console yet - I was avoiding that as this is a known issue with shoulda I just can't get any of the reported workarounds to work.