Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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.....