Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

09 Specs and N+1 problem #10

Merged
merged 32 commits into from
Feb 1, 2024
Merged

09 Specs and N+1 problem #10

merged 32 commits into from
Feb 1, 2024

Conversation

Alejandroq12
Copy link
Owner

@Alejandroq12 Alejandroq12 commented Jan 30, 2024

Hello, dear reviewer.

n+1

  • Made sure that the N+1 problem is solved when fetching all posts and their comments for a user.
    • Did not use the bullet gem in this exercise - instead analyzed the logs as showed in this article
    • Included the screenshots of my app's logs before and after the fix

Before solving N + 1 problem
Screenshot from 2024-01-29 23-19-19

After solving N + 1 problem
Screenshot from 2024-01-29 23-21-59

Integration specs

  • Used Capybara to write integration tests for each view in my project.

  • Thought on the flow of things and group the tests of page in a way that makes sense. For example, one test would check for the things in the page and another test for clicking links on it.

  • User index page:

    • I can see the username of all other users.
    • I can see the profile picture for each user.
    • I can see the number of posts each user has written.
    • When I click on a user, I am redirected to that user's show page.
  • user show page:

    • I can see the user's profile picture.
    • I can see the user's username.
    • I can see the number of posts the user has written.
    • I can see the user's bio.
    • I can see the user's first 3 posts.
    • I can see a button that lets me view all of a user's posts.
    • When I click a user's post, it redirects me to that post's show page.
    • When I click to see all posts, it redirects me to the user's post's index page.
  • User post index page:

    • I can see the user's profile picture.
    • I can see the user's username.
    • I can see the number of posts the user has written.
    • I can see a post's title.
    • I can see some of the post's body.
    • I can see the first comments on a post.
    • I can see how many comments a post has.
    • I can see how many likes a post has.
    • I can see a section for pagination if there are more posts than fit on the view.
    • When I click on a post, it redirects me to that post's show page.
  • Post show page:

    • I can see the post's title.
    • I can see who wrote the post.
    • I can see how many comments it has.
    • I can see how many likes it has.
    • I can see the post body.
    • I can see the username of each commentor.
    • I can see the comment each commentor left.

Run only integration tests:

rspec spec/system

All tests are passing:
Video of tests passing

Please, take into account that in order to run the project you have to rename the .env.example file to .env and fill all fields with the right port, database username, database password, host, port (Rails port), and database port.

Thank you. I hope you have a great day.

Alejandroq12 and others added 30 commits January 29, 2024 16:27
@Reem-lab
Copy link

@Alejandroq12 could you check your slack?

@Alejandroq12
Copy link
Owner Author

Alejandroq12 commented Jan 31, 2024

Hi, sure. I will check it now.

Copy link

@Reem-lab Reem-lab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Team, 👋🏻👋🏻

Your project is complete! There is nothing else to say other than... it's time to merge it :shipit:
Congratulations! 🎉

Highlights

  • Descriptive PR ⭐
  • Followed Gitflow ⭐
  • Test are passed 💪🏻
  • Great job working on the tests🔥🔥

Optional suggestions

Every comment with the [OPTIONAL] prefix won't stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better. Some of them were simply missed by the previous reviewer and addressing them will really improve your application.

Cheers, and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me in your question so I can receive the notification.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

@Alejandroq12
Copy link
Owner Author

Thank you very much for your time and valuable feedback.

@Alejandroq12 Alejandroq12 merged commit f914965 into dev Feb 1, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants