Sha256: 3dceb491ebf3de2efd8319f1b759bd37d4c4412d5f5ed779165baba734098bb9

Contents?: true

Size: 1.03 KB

Versions: 17

Compression:

Stored size: 1.03 KB

Contents

require "spec_helper"
require "shamu/entities"

describe Shamu::Entities::ListScope::Paging do
  let( :klass ) do
    Class.new( Shamu::Entities::ListScope ) do
      include Shamu::Entities::ListScope::ScopedPaging
    end
  end

  it "has a :page attribute" do
    expect( klass.attributes ).to have_key :page
  end

  it "has a :page.number attribute" do
    expect( klass.new.page.class.attributes ).to have_key :number
  end

  it "has a :page.size attribute" do
    expect( klass.new.page.class.attributes ).to have_key :size
  end

  it "has a :page.default_size attribute" do
    expect( klass.new.page.class.attributes ).to have_key :default_size
  end

  it "includes paging values in to_param" do
    expect( klass.new.params ).to eq page: { number: nil, size: 25 }
  end

  it "should be paged when attribute specified" do
    scope = klass.new page: { number: 1 }
    expect( scope.scoped_page? ).to be_truthy
  end

  it "should not be paged if using defaults" do
    scope = klass.new
    expect( scope.scoped_page? ).to be_falsy
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
shamu-0.0.24 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.21 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.20 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.19 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.18 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.17 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.15 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.14 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.13 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.11 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.9 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.8 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.7 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.5 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.4 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.3 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb
shamu-0.0.2 spec/lib/shamu/entities/list_scope/scoped_paging_spec.rb