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

Milestone: #Capybara specs-pair programming #9

Merged
merged 23 commits into from
Oct 3, 2023
Merged

Conversation

cosywasswa
Copy link
Owner

@cosywasswa cosywasswa commented Oct 3, 2023

👇 In this milestone, we implemented the following.

  • Fixed the N+1 problem in the controllers
  • Used Capybara to write integration tests for each view.
  • Grouped tests according to the requirements.
  • Wrote tests for users_index, user_show, posts_index, post_show pages.
  • Updated README file with project updates.
  • Fixed linter bugs
    Note: attached are N+1 screenshots.
    posts-before

posts-after

users-after

users-before

Copy link

@DammyShittu DammyShittu left a comment

Choose a reason for hiding this comment

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

Hi @cosywasswa and @manzitresor,

Highlights

✔️ Passing tests

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!

Required Changes ♻️

Check the comments under the review.

Optional suggestions

Every comment with the [OPTIONAL] prefix is not crucial enough to stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better.

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.

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 29 to 68
describe 'show page' do
before(:each) do
visit user_path(@user1)
end

it 'can see the user profile picture.' do
expect(page).to have_css("img[src='#{@user1.photo}']")
end

it 'can see the user username' do
expect(page).to have_content(@user1.name.to_s)
end

it 'I can see the number of posts the user has written.' do
expect(page).to have_content("Number of posts: #{@user1.posts_counter}")
end

it 'I can see the user bio.' do
expect(page).to have_content(@user1.bio.to_s)
end

it 'I can see the user first 3 posts.' do
@user1.recent_posts.each do |post|
expect(page).to have_content(post.text)
end
end

it 'can see a button to view all user posts' do
expect(page).to have_selector('button', text: 'See all posts')
end
end
describe 'GET/posts/show' do
it 'When I click a user post, it redirects me to that post show page' do
visit user_path(@user1)

post = @user1.recent_posts.first
click_link(post.id)
expect(page).to have_current_path(user_post_path(@user1, post))
end
end

Choose a reason for hiding this comment

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

  • Kindly add test that when we click the "See all posts" button it takes the user to the posts index page.

Comment on lines 27 to 59
it 'should see title of the post' do
@posts.each do |post|
expect(page).to have_content(post.title.to_s)
end
end
it 'I can see who wrote the post.' do
expect(page).to have_content(@user_one.name.to_s)
end
it 'I can see how many comments it has' do
@posts.each do |post|
expect(page).to have_content("Comments:#{post.comments_counter}")
end
end
it 'I can see how many likes a post has' do
@posts.each do |post|
expect(page).to have_content("Likes:#{post.likes_counter}")
end
end

it 'I can see the username of each commentor' do
@posts.each do |post|
post.recent_comments.each do |comment|
expect(page).to have_content(comment.user.name)
end
end
end
it 'I can see the comment each commentor left.' do
@posts.each do |post|
post.recent_comments.each do |comment|
expect(page).to have_content(comment.user.text)
end
end
end

Choose a reason for hiding this comment

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

  • Kindly add the tast to check that you can the post body. It is missing here.

Copy link

@DammyShittu DammyShittu left a comment

Choose a reason for hiding this comment

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

Hi @cosywasswa and @manzitresor,

Highlights

✔️ Passing tests

Great work on making the changes requested 👏
You've done well implementing some of the requested changes, but there are still some which aren't addressed yet.

Required Changes ♻️

Check the comments under the review.

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, 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 69 to 72
it 'When I click to see all posts, it redirects me to the user posts index page.' do
visit user_posts_path(@user1)
expect(page).to have_current_path(user_posts_path(@user1))
end

Choose a reason for hiding this comment

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

  • This test does not verify what is expected. You are visiting the post index page on line 70 and on line 71 you are expecting that the path is the index page path. That is redundant, don't you think so?

    You need to CLICK the "See all posts" button and ensure it redirects to the user's post index page. Take note of the click and redirect requirement

Copy link

@V-Blaze V-Blaze left a comment

Choose a reason for hiding this comment

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

Hi @cosywasswa ,

Approved 🟢 🟢

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

Highlights

  • All tests are passing💯
  • Covers all required test cases👍
  • fixed n+1 problems🟢 👍

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.

@cosywasswa cosywasswa merged commit 03c35bf into develop Oct 3, 2023
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