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

Feature/9/integration specs/v1 #9

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

geekelo
Copy link
Owner

@geekelo geekelo commented Oct 26, 2023

Use Capybara to write integration tests for each view in your project.

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.

Copy link

@DeliceLydia DeliceLydia 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,

Good job so far! There are some issues that you still need to work on to go to the next project but you are almost there!

Highlights

  • Solved N+1 problem
  • No linter errors

Required Changes ♻️

Check the comments under the review.

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.

Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.


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.

Comment on lines +1 to +61
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'post index view page', type: :system do
let!(:user1) do
User.create(
name: 'test user1',
photo: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRrkfBY9UTdiEHSYCSo7iuM4k1Eyv-u9YwGqQ&usqp=CAU',
bio: 'test_bio1',
posts_counter: 1
)
end

let!(:post1) do
Post.create(author: user1, title: 'Post 1', text: 'Post 1 content', comments_counter: 1, likes_counter: 0)
end

let!(:comment1) do
Comment.create(post: post1, author: user1, text: 'nice!')
end
let!(:comment2) do
Comment.create(post: post1, author: user1, text: 'nice!')
end

describe 'show correct post for user1' do
before(:example) do
visit user_post_path(user1, post1)
end

it 'displays the post title' do
expect(page).to have_content(post1.title)
end

it 'displays the post author' do
expect(page).to have_content(user1.name)
end

it 'displays the number of comments' do
expect(page).to have_content("comments: #{post1.comments_counter}")
end

it 'displays the number of likes' do
expect(page).to have_content("Likes: #{post1.likes_counter}")
end

it 'displays the post body' do
expect(page).to have_content(post1.text)
end

it 'displays the username of each commenter' do
expect(page).to have_content(comment1.author.name)
expect(page).to have_content(comment2.author.name)
end

it 'displays the comment left by each commenter' do
expect(page).to have_content(comment1.text)
expect(page).to have_content(comment2.text)
end
end
end

Choose a reason for hiding this comment

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

  • Some of your integration specs are not passing please make sure all tests are passing
Screenshot 2023-10-26 at 13 28 10

Copy link

@aamirkhan2478 aamirkhan2478 left a comment

Choose a reason for hiding this comment

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

Hi @geekelo,

GIF

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

Highlights

✅ You used Gitflow correctly 👍
✅ No linter error 👍
✅ Good commit messages 👍
✅ Good descriptive PR 👍
✅ Well done 👏 you did all changes given by the previous reviewer 👍

Optional suggestions

Every comment with the [OPTIONAL] prefix won't stop the approval of this PR. However, I strongly recommend you 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.

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.

None yet

4 participants