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! While you're at it, check out some resources Treehouse students have shared here.

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


Working with association tests, format errors

When I run the test on 'user_friendship_test.rb' I run into errors for the test saying:

1) Error: test: UserFriendship should belong to friend. (UserFriendshipTest): ActiveRecord::Fixture::FormatError: ActiveRecord::Fixture::FormatError

Its the same message for the four tests, now it says a format error, but I can't find it, maybe a new pair of eyes will see it.

require 'test_helper'

class UserFriendshipTest < ActiveSupport::TestCase

should belong_to(:user)
should belong_to(:friend)

# test "the truth" do # assert true test "that creating a friendship works without raising exception" do assert_nothing_raised do UserFriendship.create user: users(:allan), friend: users(:mike) end end

test "that creating a friendship based on user id and friend id works" do
    UserFriendship.create user_id: users(:allan).id, friend_id: users(:mike).id
    assert users(:allan).friends.include?(users(:mike))

end end


4 Answers

Jason Seifer
Jason Seifer
Treehouse Guest Teacher

Hey Allan,

Try opening up your users.yml and user_friendships.yml fixture files and convert the tabs to spaces. If you're using Sublime Text, this can be done by going to the "View" menu, then "Indentation" and "Convert tabs to space". Then save the file. Hope that helps!

Ok, i thought i removed any tabs, but ill give it another shot.

I am still having the same issue, could it have the only other problem is that I can't use the "bin/rails" in certain commands but they still run with "rails".

I found it, I didn't take the brackets out.....