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)
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?
Aucun commentaire:
Enregistrer un commentaire