Sha256: a0d876b8df283e0f3569b75b4026a842b1d0e9aca1b54f671f227933251477f1

Contents?: true

Size: 841 Bytes

Versions: 55

Compression:

Stored size: 841 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe LHS::Record do
  let(:next_parameter) do
    { next: { href: 'http://example.com/users?from_user_id=100&limit=100' } }
  end
  let(:data_hash) { { items: 98.times.map { { foo: 'bar' } }, limit: 10 }.merge(next_parameter) }

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

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

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

  it 'responds to pages_left?' do
    expect(pagination.pages_left?).to be true
  end

  context 'when there is no next' do
    let(:next_parameter) { {} }

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

    it 'responds to pages_left?' do
      expect(pagination.pages_left?).to be false
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
lhs-26.2.0 spec/pagination/link/pages_left_spec.rb
lhs-26.1.0 spec/pagination/link/pages_left_spec.rb
lhs-26.0.1 spec/pagination/link/pages_left_spec.rb
lhs-26.0.0 spec/pagination/link/pages_left_spec.rb
lhs-25.2.0 spec/pagination/link/pages_left_spec.rb
lhs-25.1.0 spec/pagination/link/pages_left_spec.rb
lhs-25.0.4 spec/pagination/link/pages_left_spec.rb
lhs-25.0.3 spec/pagination/link/pages_left_spec.rb
lhs-25.0.2 spec/pagination/link/pages_left_spec.rb
lhs-25.0.1 spec/pagination/link/pages_left_spec.rb
lhs-25.0.0 spec/pagination/link/pages_left_spec.rb
lhs-24.1.2 spec/pagination/link/pages_left_spec.rb
lhs-24.1.1 spec/pagination/link/pages_left_spec.rb
lhs-24.1.0 spec/pagination/link/pages_left_spec.rb
lhs-24.1.0.pre.2 spec/pagination/link/pages_left_spec.rb
lhs-24.1.0.pre.1 spec/pagination/link/pages_left_spec.rb
lhs-24.0.0 spec/pagination/link/pages_left_spec.rb
lhs-23.0.2 spec/pagination/link/pages_left_spec.rb
lhs-23.0.1 spec/pagination/link/pages_left_spec.rb
lhs-23.0.0 spec/pagination/link/pages_left_spec.rb