Sha256: ec6190fe4bc80592c1c262d6dd2e41d6ae2dbf7358f76533e300bd53570d84b2

Contents?: true

Size: 746 Bytes

Versions: 34

Compression:

Stored size: 746 Bytes

Contents

require 'rails_helper'

describe Tabulatr::Data::Pagination do
  class DummyPaginationClass
    include Tabulatr::Data::Pagination
  end

  before(:all) do
    @dummy = DummyPaginationClass.new
  end
  describe '.compute_pagination' do
    it "computes an offset" do
      count = (1..20).to_a
      @dummy.instance_variable_set('@relation', count)
      pagination = @dummy.compute_pagination(1, 10)
      expect(pagination[:offset]).to be 0
      pagination = @dummy.compute_pagination(2, 10)
      expect(pagination[:offset]).to be 10
      pagination = @dummy.compute_pagination(3, 10)
      expect(pagination[:offset]).to be 20
      pagination = @dummy.compute_pagination(4, 10)
      expect(pagination[:offset]).to be 30
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
tabulatr2-0.10.4 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.10.3 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.10.2 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.10.1 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.10.0 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.48 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.47 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.46 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.45 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.44 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.43 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.42 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.41 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.40 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.39 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.38 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.37 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.36 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.35 spec/lib/tabulatr/data/pagination_spec.rb
tabulatr2-0.9.34 spec/lib/tabulatr/data/pagination_spec.rb