Sha256: 53ae092e6995c49472e26a31f107fd845f3f83a2ff968066485b190982a48c51
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
describe Slack::Pager do describe "#initialize" do let(:page) { { limit: 20 } } it "initializes with a page" do expect(described_class.new(page).page).to eq page end it "saves the limit" do expect(described_class.new(page).limit).to eq 20 end it "initializes a nil cursor" do expect(described_class.new(page).cursor).to be_nil end end describe "#empty?" do context "with a non-empty page" do it "is not empty" do expect(described_class.new({ limit: 200 })).to_not be_empty end end context "with an empty page" do it "is empty" do expect(described_class.new({})).to be_empty end end context "with a nil page" do it "is empty" do expect(described_class.new(nil)).to be_empty end end end describe "#to_h" do subject { described_class.new({ limit: 200 }) } it "returns a hash with the limit and the cursor" do expect(subject.to_h).to eq({ limit: 200, cursor: nil }) end end describe "#next" do subject { described_class.new({ limit: 200 }) } it "returns a new instance of the pager" do pager = subject.next("next") expect(pager).to be_instance_of(described_class) expect(pager).to_not equal subject end it "sets the cursor" do expect(subject.next("next").cursor).to eq "next" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
laziness-0.2.5 | spec/laziness/pager_spec.rb |