Sha256: fe48cc55cf3be065a4e64556e39421c631be6f047ccd8821b166edcc6975fc7e
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
require 'helper' describe Plucky::Pagination::Collection do context "Object decorated with Collection with paginator set" do before do @object = [1, 2, 3, 4] @object_id = @object.object_id @paginator = Plucky::Pagination::Paginator.new(20, 2, 10) end subject { Plucky::Pagination::Collection.new(@object, @paginator) } it "knows paginator" do subject.paginator.should == @paginator end [:total_entries, :current_page, :per_page, :total_pages, :out_of_bounds?, :previous_page, :next_page, :skip, :limit, :offset].each do |method| it "delegates #{method} to paginator" do subject.send(method).should == @paginator.send(method) end end it "does not interfere with other methods on the object" do @object.object_id.should == @object_id @object.should == [1, 2, 3, 4] @object.size.should == 4 @object.select { |o| o > 2 }.should == [3, 4] end it "delegates missing methods to the paginator" do @paginator.should_receive(:blather_matter).with('hello', :xyz, 4) subject.blather_matter('hello', :xyz, 4) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
plucky-0.8.0 | spec/plucky/pagination/collection_spec.rb |
plucky-0.7.0 | spec/plucky/pagination/collection_spec.rb |