Last active
November 4, 2017 17:26
-
-
Save domagude/3c06b8e0b7fb9e12ce74f77cb58d45a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rails_helper" | |
RSpec.feature "Infinite scroll", :type => :feature do | |
Post.per_page = 15 | |
let(:check_posts_count) do | |
expect(page).to have_selector('.single-post-list', count: 15) | |
page.execute_script("$(window).scrollTop($(document).height())") | |
expect(page).to have_selector('.single-post-list', count: 30) | |
end | |
scenario "User scrolls down the hobby page | |
and posts list will be appended with older posts", js: true do | |
create_list(:post, 30, category: create(:category, branch: 'hobby')) | |
visit hobby_posts_path | |
check_posts_count | |
end | |
scenario "User scrolls down the study page | |
and posts list will be appended with older posts", js: true do | |
create_list(:post, 30, category: create(:category, branch: 'study')) | |
visit study_posts_path | |
check_posts_count | |
end | |
scenario "User scrolls down the team page | |
and posts list will be appended with older posts", js: true do | |
create_list(:post, 30, category: create(:category, branch: 'team')) | |
visit team_posts_path | |
check_posts_count | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment