Sha256: 5c9ec2afcf7b8e4a3a995096f54064fbd49ff8b3974ffa2c6b0a6614e0cc9c7f

Contents?: true

Size: 871 Bytes

Versions: 7

Compression:

Stored size: 871 Bytes

Contents

require File.join(File.dirname(__FILE__), "helpers", "spec_helper")

describe Videojuicer::Resource::Collection do

  before(:all) do
    @objects = [:foo]*100
    @collection = Videojuicer::Resource::Collection.new(@objects[0..9], 155, 17, 10)
  end
  
  it "is instantiated correctly" do    
    @collection.should be_kind_of(Videojuicer::Resource::Collection)
    @collection.total.should == 155
    @collection.offset.should == 17
    @collection.limit.should == 10
  end
  
  it "can count the number of pages" do
    @collection.page_count.should == 16
  end
  
  it "can tell the current page" do
    @collection.page_number.should == 2
  end
  
  it "pagination copes with a nil limit" do
    collection = Videojuicer::Resource::Collection.new(@objects[0..9], 155, 17, nil)
    collection.page_count.should == 1
    collection.page_number.should == 1
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vj-sdk-0.5.1 spec/collection_spec.rb
vj-sdk-0.5.0 spec/collection_spec.rb
vj-sdk-0.4.3 spec/collection_spec.rb
vj-sdk-0.4.2 spec/collection_spec.rb
vj-sdk-0.4.1 spec/collection_spec.rb
vj-sdk-0.4.0 spec/collection_spec.rb
vj-sdk-0.2.1 spec/collection_spec.rb