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

Ruby

Christian Georg Strobl
Christian Georg Strobl
27,656 Points

Problems with CoCh: Testing Controller Assingments Task 1

Hi, having some problems with the testing controller assingments task 1 of building social features in ruby. Somehow don't really see, where is the problem and will be very thankful for help:

  should "assign a friend" do
    get :new, friend_id: users(:jim).id
    assert_equal @controller, assigns users(:jim)      
  end

  should "assign a user friendship" do
    get :new, friend_id: users(:jim).id
    # Write your code for step 2 here
     end
   end
 end
end

1 Answer

Marc Ft
Marc Ft
18,065 Points

Hi Christian, I would love to help you with this.

the first challenge asks you to set controller instance variable friend to users fixture for jim:

should "assign a friend" do get :new, friend_id: users(:jim).id get :new, friend: users(:jim) end