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

Robert Gray
Robert Gray
6,674 Points

Rails Treebook: Test Should Redirect Status Update when not logged in NoMethod Error Statuses

<code>test "should redirect status update when not logged in" do put :update, id: @status, status: { content: @status.content } assert_response :redirect assert_redirected_to new_user_session_path end </code>

I get this error message when trying to run the test

test_should_redirect_status_update_when_not_logged_in(StatusesControllerTest): NoMethodError: undefined method `statuses' for nil:NilClass

2 Answers

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey Robert Gray, it looks like the user isn't being found. Can you send me a link to your GitHub treebook repository and I'll take a look?