kathytbui / viewing_party

Starter repo for a backend module 3 project.
0 stars 1 forks source link

Dashboard: Friends #16

Closed iandouglas closed 4 years ago

iandouglas commented 4 years ago

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:

  1. If I have not added any friends there should be a message. "You currently have no friends".

  2. 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.

  1. When Bugs Bunny enters lola_bunny@gmail.com to add friend it will be successful and Lola should show up as Bugs Bunny's friend.
  2. When Bugs Bunny enters 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 ;)

kathytbui commented 4 years ago

Resources for this User Story

ajtran303 commented 4 years ago

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.

ajtran303 commented 4 years ago

For now, we know that everything is working so we will proceed and then backfill the test later.