Sha256: 4b117bed70b7e682eb96d333928874fe650b5323e585e591e06587a8de1efcf1
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true require "spec_helper" require "split/dashboard/paginator" describe Split::DashboardPaginator do context "when collection is 1..20" do let(:collection) { (1..20).to_a } context "when per 5 for page" do let(:per) { 5 } it "when page number is 1 result is [1, 2, 3, 4, 5]" do result = Split::DashboardPaginator.new(collection, 1, per).paginate expect(result).to eql [1, 2, 3, 4, 5] end it "when page number is 2 result is [6, 7, 8, 9, 10]" do result = Split::DashboardPaginator.new(collection, 2, per).paginate expect(result).to eql [6, 7, 8, 9, 10] end end context "when per 10 for page" do let(:per) { 10 } it "when page number is 1 result is [1..10]" do result = Split::DashboardPaginator.new(collection, 1, per).paginate expect(result).to eql [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] end it "when page number is 2 result is [10..20]" do result = Split::DashboardPaginator.new(collection, 2, per).paginate expect(result).to eql [11, 12, 13, 14, 15, 16, 17, 18, 19, 20] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
split-4.0.4 | spec/dashboard/paginator_spec.rb |
split-4.0.3 | spec/dashboard/paginator_spec.rb |
split-4.0.2 | spec/dashboard/paginator_spec.rb |