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 trialRobert Borsey
Courses Plus Student 9,636 PointsJason Seifer or staff or anyone who knows statuses_controller_test.rb questions
I'm getting this failure when I test statuses_controller_test.rb 1) Failure: test_should_create_status_when_logged_in(StatusesControllerTest) [test/functional/statuses_controller_test.rb:35]: "Status.count" didn't change by 1. <3> expected but was <2>.
11 tests, 17 assertions, 1 failures, 0 errors, 0 skips I have put the before_filter :authenticate_user!, only:[:new, :create, :edit, :update] in the statuses_controller_rb and I'm still getting this error a few people been posting about it still cant find a solution please help. Also when running user_test.rb I am getting this 1) Failure: test_a_user_can_have_a_correctly_formatted_profile_name(UserTest) [test/unit/user_test.rb:41]: Failed assertion, no message given.
6 tests, 12 assertions, 1 failures, 0 errors, 0 skips 41 assert user.valid? when I write it like this it passes asset !usre.valid? is this right if not please help Thank you
6 Answers
Jason Seifer
Treehouse Guest TeacherCan you paste a link to your code up on GitHub? I don't think I have enough information here to troubleshoot.
Robert Borsey
Courses Plus Student 9,636 Pointsok I'll try have to find out how to do it thank you for responding
Robert Borsey
Courses Plus Student 9,636 Pointsquick rundown on what's failing in statuses_controller_test.rb test "should create status when logged in" do sign_in users(:robert)
assert_difference('Status.count') do #This is line 35
post :create, status: { content: @status.content }
end
and failure message
1) Failure:
test_should_create_status_when_logged_in(StatusesControllerTest) [test/functional/statuses_controller_test.rb:35]:
"Status.count" didn't change by 1.
<3> expected but was
<2>.
11 tests, 17 assertions, 1 failures, 0 errors, 0 skips
Robert Borsey
Courses Plus Student 9,636 Pointsok found the problem (SOLVED)for statuses controller sill having problems with testing the user_test.rb file
Robert Borsey
Courses Plus Student 9,636 PointsI'm having the same problem in this post https://teamtreehouse.com/forum/help-ruby-on-rails-testing-the-profile-name like everyone else . so its probably some little error can you look at that post and let me know thank you
Jason Seifer
Treehouse Guest TeacherRobert Borsey can you possibly drop a link to your code up on GitHub along with the exact error you're getting? That will make it much easier to troubleshoot and help out.