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
Casey Clayton
16,708 Pointsassign a friend" test
Stuck on this Code Challange. It asks heck to make sure that the controller instance variable friend is equal to the users fixture for jim. And gives this code, but I'm not quite sure how to go about this.
class UserFriendshipsControllerTest < ActionController::TestCase
context "#new" do
context "when logged in" do
setup do
sign_in users(:jason)
end
should "assign a friend" do
get :new, friend_id: users(:jim).id
# Write your code for step 1 here
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
3 Answers
Steve Schofield
Courses Plus Student 7,465 PointsAh, also solved.
assert_equal users(:jim), assigns(:friend)
Casey Clayton
16,708 PointsSolved!
Steve Schofield
Courses Plus Student 7,465 PointsWhat was your solution? I'm a bit stuck here too...