Sha256: f2d4751a6c04a10a1e48b3d16191ab949b3ce74a4b0d62dfbb9c57a978a654e0
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
shared_examples_for "a paginated collection" do let(:paginated_items) { VCR.use_cassette(cassette('items')) { described_class.find(:all) } } it "should have a pagination object" do expect(paginated_items.pagination).to be end describe "the pagination object" do let(:pagination) { paginated_items.pagination } it "has a total" do expect(pagination[:total]).to be end it "has a page number" do expect(pagination[:page]).to be end end describe "specify per_page" do let(:per_page) { VCR.use_cassette(cassette('per_page')) { described_class.where(per_page: 7) } } it "can specify a per_page" do expect(per_page.size).to eq 7 end end describe "getting a different page" do let(:six_things) { VCR.use_cassette(cassette('six_things')) { described_class.where(page: 1, per_page: 6) } } let(:next_page) { VCR.use_cassette(cassette('next_page')) { described_class.where(page: 2, per_page: 3) } } it "gets the next page of stuff" do expect(six_things[3..5].map(&:id)).to eq next_page.map(&:id) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pipeline_deals-0.5.0 | spec/support/pagination_spec.rb |
pipeline_deals-0.4.0 | spec/support/pagination_spec.rb |
pipeline_deals-0.3.0 | spec/support/pagination_spec.rb |