Closed iandouglas closed 4 years ago
Resources for this User Story
The problem is: in development, the feature works but in the test is failing.
Our feature test is failing to test that a friendship is created.
But when we pry everywhere else (controller, view, model) and even invoke the method that we are testing in the rails console, and look in the browser, it is totally working.
We know that there is something going on with .reload
-- we have to use a .reload
because the the changes to the user that we are testing would not otherwise persist between http requests sent in the headless browser of the testing environment.
But calling .reload
isn't working either. We tried moving the invocation up and down lines through the spec and it wasn't appearing to affect anything.
We also tried to reset the testing database and restarting the terminal to run the tests.
And that is where we are stuck.
For now, we know that everything is working so we will proceed and then backfill the test later.
As an authenticated user, I see a section for friends, In this section, there should be a text field to enter a friend's email and a button to "Add Friend"
Scenarios:
If I have not added any friends there should be a message. "You currently have no friends".
If I have added friends, I should see a list of all my friends.
Details: Users should be able to add a friend by their email address, as long as, the friend is a user of our application and exists in our database.
Example: Bugs Bunny and Lola Bunny are users of our application, but Daffy Duck is not.
lola_bunny@gmail.com
to add friend it will be successful and Lola should show up as Bugs Bunny's friend.daffy_duck@gmail.com
to add friend it should give an error message that the user does not exist.Tips: You'll want to research self-referential
has_many through
. Here is a good starting point to understand the concept. You will probably need to do more googling but that's part of the fun ;)