Created
January 31, 2013 13:26
-
-
Save marciok/4682848 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/model/user.rb | |
has_and_belongs_to_many :friends, class_name: 'User', inverse_of: :friends | |
# spec/model/user_spec.rb | |
it { should have_and_belong_to_many(:friends).of_type('User').as_inverse_of(:friends) } | |
# Error message | |
#1) User Associations | |
# Failure/Error: it { should have_and_belong_to_many(:friends).of_type('User').as_inverse_of(:friends) } | |
# Expected User to reference and referenced in many "friends" of type "User" which is an inverse of "friends", got User #references and referenced in many friends of type User |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment