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

Nelly Nelly
Nelly Nelly
7,134 Points

Rails test problem....

Hi everyone,

When I run my test I have these failure, I can't find where it comes from...

# Running:

.....F............F.....F................

Finished in 1.107771s, 37.0113 runs/s, 65.8981 assertions/s.

  1) Failure:
UserFriendshipsControllerTest#test_: #index When logged in requested friendships should not display pending or active friend's names.  [test/controllers/user_friendships_controller_test.rb:94]:
Expected /Blocked/ to not match "<!DOCTYPE html>\n<html>\n<head>\n  <title>Treebook</title>\n  <link rel=\"stylesheet\" media=\"all\" href=\"/assets/application-7d93065fcda3c579dfd6445f789a15bf8ff6c293bbcbf35f28cb4f672636aa67.css\" data-turbolinks-track=\"true\" />\n  <script src=\"/assets/application-b52f28b840ea206f77697062f0e2298e1d60ce91ddfe818da2e09d8c7d191c6f.js\" data-turbolinks-track=\"true\"></script>\n  \n</head>\n\n<nav class=\"navbar navbar-inverse navbar-static-top\">\n    <div class=\"container\">\n      <div>\n        <a class=\"navbar-brand\" href=\"#\">\n        TreeBook\n        </a>\n        <ul class=\"nav navbar-nav navbar-left\">\n          <li><a href=\"/feed\">All Statuses</a></li>\n        </ul>\n        <ul class=\"nav navbar-nav navbar-right\">\n            <li><a href=\"/user_friendships\">Friends</a></li>\n            <li><a href=\"/users/edit\">Jason Seifer</a></li>\n            <li><a href=\"/logout\">Log Out</a></li>\n        </ul>\n      </div>\n    </div>\n</nav>\n<body>\n\n\n <div class=\"container\">\n\n\n\n\n\n   <div class= \" page-header\">\n  <h1>Friends</h1>\n</div>\n\n<div class=\"row\">\n  <strong>Friend list:</strong>\n  <a href=\"/user_friendships?list=blocked\">Blocked</a>\n  <a href=\"/user_friendships?list=requested\">Requested</a>\n  <a href=\"/user_friendships?list=accepted\">Accepted</a>\n  <a href=\"/user_friendships?list=pending\">Pending</a>\n</div>\n<br>\n<div class=\"row\">\n    <div id=\"user_friendship_980190965\" class=\"friend\">\n      <div class=\"col-xs-2\">\n        <a href=\"/user15\"><img src=\"\" /></a>\n      </div>\n      <div class=\"col-xs-7\">\n        <strong>Requested Friend</strong>\n\n\n            <em>Friendship requested.</em> <a href=\"/user_friendships/user15/edit\">Accept friendship</a>\n\n      </div>\n    </div>\n</div>\n\n </div>\n\n\n</body>\n</html>\n".


  2) Failure:
UserFriendshipsControllerTest#test_: #index When logged in pending friendships should not display pending or active friend's names.  [test/controllers/user_friendships_controller_test.rb:75]:
Expected /Blocked/ to not match "<!DOCTYPE html>\n<html>\n<head>\n  <title>Treebook</title>\n  <link rel=\"stylesheet\" media=\"all\" href=\"/assets/application-7d93065fcda3c579dfd6445f789a15bf8ff6c293bbcbf35f28cb4f672636aa67.css\" data-turbolinks-track=\"true\" />\n  <script src=\"/assets/application-b52f28b840ea206f77697062f0e2298e1d60ce91ddfe818da2e09d8c7d191c6f.js\" data-turbolinks-track=\"true\"></script>\n  \n</head>\n\n<nav class=\"navbar navbar-inverse navbar-static-top\">\n    <div class=\"container\">\n      <div>\n        <a class=\"navbar-brand\" href=\"#\">\n        TreeBook\n        </a>\n        <ul class=\"nav navbar-nav navbar-left\">\n          <li><a href=\"/feed\">All Statuses</a></li>\n        </ul>\n        <ul class=\"nav navbar-nav navbar-right\">\n            <li><a href=\"/user_friendships\">Friends</a></li>\n            <li><a href=\"/users/edit\">Jason Seifer</a></li>\n            <li><a href=\"/logout\">Log Out</a></li>\n        </ul>\n      </div>\n    </div>\n</nav>\n<body>\n\n\n <div class=\"container\">\n\n\n\n\n\n   <div class= \" page-header\">\n  <h1>Friends</h1>\n</div>\n\n<div class=\"row\">\n  <strong>Friend list:</strong>\n  <a href=\"/user_friendships?list=blocked\">Blocked</a>\n  <a href=\"/user_friendships?list=requested\">Requested</a>\n  <a href=\"/user_friendships?list=accepted\">Accepted</a>\n  <a href=\"/user_friendships?list=pending\">Pending</a>\n</div>\n<br>\n<div class=\"row\">\n    <div id=\"user_friendship_980190963\" class=\"friend\">\n      <div class=\"col-xs-2\">\n        <a href=\"/user28\"><img src=\"\" /></a>\n      </div>\n      <div class=\"col-xs-7\">\n        <strong>Pending Friend</strong>\n\n            <em>Friendship is pending.</em> <a href=\"/user_friendships/user28/edit\">Delete request</a>\n\n\n      </div>\n    </div>\n</div>\n\n </div>\n\n\n</body>\n</html>\n".


  3) Failure:
UserFriendshipsControllerTest#test_: #index When logged in accepted friendships should not display pending or active friend's names.  [test/controllers/user_friendships_controller_test.rb:113]:
Expected /Blocked/ to not match "<!DOCTYPE html>\n<html>\n<head>\n  <title>Treebook</title>\n  <link rel=\"stylesheet\" media=\"all\" href=\"/assets/application-7d93065fcda3c579dfd6445f789a15bf8ff6c293bbcbf35f28cb4f672636aa67.css\" data-turbolinks-track=\"true\" />\n  <script src=\"/assets/application-b52f28b840ea206f77697062f0e2298e1d60ce91ddfe818da2e09d8c7d191c6f.js\" data-turbolinks-track=\"true\"></script>\n  \n</head>\n\n<nav class=\"navbar navbar-inverse navbar-static-top\">\n    <div class=\"container\">\n      <div>\n        <a class=\"navbar-brand\" href=\"#\">\n        TreeBook\n        </a>\n        <ul class=\"nav navbar-nav navbar-left\">\n          <li><a href=\"/feed\">All Statuses</a></li>\n        </ul>\n        <ul class=\"nav navbar-nav navbar-right\">\n            <li><a href=\"/user_friendships\">Friends</a></li>\n            <li><a href=\"/users/edit\">Jason Seifer</a></li>\n            <li><a href=\"/logout\">Log Out</a></li>\n        </ul>\n      </div>\n    </div>\n</nav>\n<body>\n\n\n <div class=\"container\">\n\n\n\n\n\n   <div class= \" page-header\">\n  <h1>Friends</h1>\n</div>\n\n<div class=\"row\">\n  <strong>Friend list:</strong>\n  <a href=\"/user_friendships?list=blocked\">Blocked</a>\n  <a href=\"/user_friendships?list=requested\">Requested</a>\n  <a href=\"/user_friendships?list=accepted\">Accepted</a>\n  <a href=\"/user_friendships?list=pending\">Pending</a>\n</div>\n<br>\n<div class=\"row\">\n    <div id=\"user_friendship_980190964\" class=\"friend\">\n      <div class=\"col-xs-2\">\n        <a href=\"/user37\"><img src=\"\" /></a>\n      </div>\n      <div class=\"col-xs-7\">\n        <strong>Active Friend</strong>\n\n\n\n            <em>Friendship started 2016-08-28 20:27:44 UTC.</em> <a href=\"/user_friendships/user37/edit\">Update friendship</a>\n      </div>\n    </div>\n</div>\n\n </div>\n\n\n</body>\n</html>\n".

41 runs, 73 assertions, 3 failures, 0 errors, 0 skips

It was asked here https://teamtreehouse.com/community/ruby-problemsome years ago but no solution yet?

mmm I tried to email the staff but I got suggested to ask here first... so...

Here is my github repo https://github.com/knopfler81/treebook/tree/block_friend

I hope you could help me before the courses are removed i'd like to understand what happened :)

Cheers