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
Jon Thomas
8,916 PointsRuby on Rails failing test
I seem to be getting a failing test all of the sudden:
1) Failure:
test: #index when logged in should display pending information on an accepted friendship. (UserFriendshipsControllerTest) [test/functional/user_friendships_controller_test.rb:41]:
<"Friendship is accepted."> expected but was
<"Friendship is pending.">.
Line 40 - 44 in my test:
should "display pending information on an accepted friendship" do
assert_select "#user_friendship_#{@friendship1.id}" do
assert_select "em", "Friendship is accepted."
end
end
And here's what's in my index action of user_friendships_controller.rb
def index
@user_friendships = current_user.user_friendships.all
end
5 Answers
Jason Seifer
Treehouse Guest TeacherHi Jon, can you zip up your project and email it to help@teamtreehouse.com?
Jon Thomas
8,916 PointsJust searched through the forums to find this post to see if anyone replied! Must have missed your reply in my email. Zipping up and sending now. I just spent the morning again trying to figure out what the problem was.
Jon Thomas
8,916 PointsI believe I'm ok now. The version of the Draper gem I had was more recent than what was originally in the videos, and I needed some delegate_all in the UserFriendshipDecorator.
Jon Thomas
8,916 PointsI am, however, getting this error now:
Error:
test_should_update_status_for_the_current_user_when_logged_in(StatusesControllerTest):
ActiveRecord::RecordNotFound: Couldn't find Status with id=980190962 [WHERE "statuses"."user_id" = 754184369]
Jon Thomas
8,916 PointsFound the issue with that one too. I was signing in the wrong user for the "should update status for teh current user when logged in" test.
I believe I'm good to go. All tests pass.