Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Khemraj Thapa8,885 Points
Error while testing friendhships :Solved
Hi, I have followed everything shown on the video but still getting 3 errors like below:
test: UserFriendship should belong to friend. (UserFriendshipTest): ActiveRecord::Fixture::FormatError: ActiveRecord::Fixture::FormatError
Error: test: UserFriendship should belong to user. (UserFriendshipTest): ActiveRecord::Fixture::FormatError: ActiveRecord::Fixture::FormatError
Error: test_that_creating_a_friendship_works_without_raising_an_exception(UserFriendshipTest): ActiveRecord::Fixture::FormatError: ActiveRecord::Fixture::FormatError
What am i doing wrong? Thanks in advance
Tomasz Foster19,442 Points
The test you wrote fails because the user friendship doesn't belong to a friend, which is what you're testing for. Therefore, make sure you have a belongs_to association in your user friendship model for the :user.
Without seeing the rest of the code it's hard to see what's wrong, but I would suggest checking your App / models / user_friendship.rb file.