Sha256: 09b639821aeedbadb2fd20896274242c836d2f7a6aa14cefb67c56faa66d748f

Contents?: true

Size: 709 Bytes

Versions: 43

Compression:

Stored size: 709 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::OffsetPagination.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

43 entries across 43 versions & 1 rubygems

Version Path
lhs-6.6.2 spec/pagination/pages_left_spec.rb
lhs-6.6.1 spec/pagination/pages_left_spec.rb
lhs-6.6.0 spec/pagination/pages_left_spec.rb
lhs-6.5.0 spec/pagination/pages_left_spec.rb
lhs-6.4.0 spec/pagination/pages_left_spec.rb
lhs-6.3.1 spec/pagination/pages_left_spec.rb
lhs-6.3.0 spec/pagination/pages_left_spec.rb
lhs-6.2.0 spec/pagination/pages_left_spec.rb
lhs-6.1.0 spec/pagination/pages_left_spec.rb
lhs-6.0.0 spec/pagination/pages_left_spec.rb
lhs-5.7.1 spec/pagination/pages_left_spec.rb
lhs-5.7.0 spec/pagination/pages_left_spec.rb
lhs-5.6.6 spec/pagination/pages_left_spec.rb
lhs-5.6.5 spec/pagination/pages_left_spec.rb
lhs-5.6.4 spec/pagination/pages_left_spec.rb
lhs-5.6.3 spec/pagination/pages_left_spec.rb
lhs-5.6.2 spec/pagination/pages_left_spec.rb
lhs-5.6.1 spec/pagination/pages_left_spec.rb
lhs-5.6.0 spec/pagination/pages_left_spec.rb
lhs-5.5.0 spec/pagination/pages_left_spec.rb