Sha256: 6f13dbab8ab63d2ce302107be5fc0d5b665d14293b24d57f10f345287da02e55

Contents?: true

Size: 711 Bytes

Versions: 58

Compression:

Stored size: 711 Bytes

Contents

require 'rails_helper'

describe LHS::Record do
  let(:offset) { 0 }
  let(:data_hash) { { items: 98.times.map { { foo: 'bar' } }, total: 98, offset: offset, limit: 10 } }

  let(:data) do
    LHS::Data.new(data_hash, nil, Record)
  end

  let(:pagination) { LHS::Pagination::Offset.new(data) }

  before(:each) do
    class Record < LHS::Record
      endpoint ':datastore/v2/data'
    end
  end

  it 'responds to pages_left' do
    expect(pagination.pages_left).to eq(9)
  end

  context 'when there is no offset' do
    let(:offset) { nil }

    it 'responds to pages_left' do
      # TODO i now set the nil offset to zero. Is this ok or wrong?
      expect(pagination.pages_left).to eq(9)
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
lhs-14.6.5 spec/pagination/pages_left_spec.rb
lhs-14.6.4 spec/pagination/pages_left_spec.rb
lhs-14.6.3 spec/pagination/pages_left_spec.rb
lhs-14.6.2 spec/pagination/pages_left_spec.rb
lhs-14.6.1 spec/pagination/pages_left_spec.rb
lhs-14.6.0 spec/pagination/pages_left_spec.rb
lhs-14.5.0 spec/pagination/pages_left_spec.rb
lhs-14.4.0 spec/pagination/pages_left_spec.rb
lhs-14.3.4 spec/pagination/pages_left_spec.rb
lhs-14.3.3 spec/pagination/pages_left_spec.rb
lhs-14.3.2 spec/pagination/pages_left_spec.rb
lhs-14.3.1 spec/pagination/pages_left_spec.rb
lhs-14.3.0 spec/pagination/pages_left_spec.rb
lhs-14.2.0 spec/pagination/pages_left_spec.rb
lhs-14.1.1 spec/pagination/pages_left_spec.rb
lhs-14.1.0 spec/pagination/pages_left_spec.rb
lhs-14.0.3 spec/pagination/pages_left_spec.rb
lhs-14.0.2 spec/pagination/pages_left_spec.rb
lhs-14.0.1 spec/pagination/pages_left_spec.rb
lhs-14.0.0 spec/pagination/pages_left_spec.rb