Sha256: f2dbace021bb68e1566e7ffdb727966eb2b342935bada3f1b7d8f9baabfedcaa

Contents?: true

Size: 737 Bytes

Versions: 21

Compression:

Stored size: 737 Bytes

Contents

# frozen_string_literal: true

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 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

21 entries across 21 versions & 1 rubygems

Version Path
lhs-19.5.0 spec/pagination/pages_left_spec.rb
lhs-19.5.0.pre.wherehref.1 spec/pagination/pages_left_spec.rb
lhs-19.4.1 spec/pagination/pages_left_spec.rb
lhs-19.4.0 spec/pagination/pages_left_spec.rb
lhs-19.3.1 spec/pagination/pages_left_spec.rb
lhs-19.3.0 spec/pagination/pages_left_spec.rb
lhs-19.2.0 spec/pagination/pages_left_spec.rb
lhs-19.1.0 spec/pagination/pages_left_spec.rb
lhs-19.0.2 spec/pagination/pages_left_spec.rb
lhs-19.0.1 spec/pagination/pages_left_spec.rb
lhs-19.0.0 spec/pagination/pages_left_spec.rb
lhs-19.0.0.pre.endpoint.1 spec/pagination/pages_left_spec.rb
lhs-18.0.3 spec/pagination/pages_left_spec.rb
lhs-18.0.2 spec/pagination/pages_left_spec.rb
lhs-18.0.1 spec/pagination/pages_left_spec.rb
lhs-18.0.0 spec/pagination/pages_left_spec.rb
lhs-17.0.1 spec/pagination/pages_left_spec.rb
lhs-17.0.1.pre1 spec/pagination/pages_left_spec.rb
lhs-18.0.0.pre.pre1 spec/pagination/pages_left_spec.rb
lhs-17.0.0 spec/pagination/pages_left_spec.rb