decidim-proposals/spec/features/proposals_spec.rb in decidim-0.4.0 vs decidim-proposals/spec/features/proposals_spec.rb in decidim-0.4.1

- old
+ new

@@ -409,13 +409,13 @@ it "lists the proposals ordered randomly by default" do visit_feature expect(page).to have_selector("a", text: "Random") - expect(page).to have_selector("#proposals .card-grid .column", count: 2) - expect(page).to have_selector("#proposals .card-grid .column", text: lucky_proposal.title) - expect(page).to have_selector("#proposals .card-grid .column", text: unlucky_proposal.title) + expect(page).to have_selector(".card--proposal", count: 2) + expect(page).to have_selector(".card--proposal", text: lucky_proposal.title) + expect(page).to have_selector(".card--proposal", text: unlucky_proposal.title) end end it "lists all the proposals" do create(:proposal_feature, @@ -485,17 +485,17 @@ end end context "when there are a lot of proposals" do before do - create_list(:proposal, 17, feature: feature) + create_list(:proposal, Decidim::Paginable::OPTIONS.first + 5, feature: feature) end it "paginates them" do visit_feature - expect(page).to have_css(".card--proposal", count: 12) + expect(page).to have_css(".card--proposal", count: Decidim::Paginable::OPTIONS.first) click_link "Next" expect(page).to have_selector(".pagination .current", text: "2") @@ -748,8 +748,15 @@ expect(page).to have_selector("#proposals .card-grid .column:first-child", text: recent_proposal.title) expect(page).to have_selector("#proposals .card-grid .column:last-child", text: older_proposal.title) end end + end + + context "when paginating" do + let!(:collection) { create_list :proposal, collection_size, feature: feature } + let!(:resource_selector) { ".card--proposal" } + + it_behaves_like "a paginated resource" end end end