Sha256: 8ab5513371af5a6453804d655616418e97dc625517061b67f1e116b3508c8bcd

Contents?: true

Size: 736 Bytes

Versions: 4

Compression:

Stored size: 736 Bytes

Contents

require "test_helper"

class ActiveRecordTest < Test::Unit::TestCase
  def setup
    15.times {|i| Thing.create(:name => "Thing #{i}") }
    Paginate::Config.size = 10
  end

  def test_respond_to_paginate_method
    assert_respond_to Thing, :paginate
  end

  def test_paginate_with_defaults
    things = Thing.all(:limit => 11)
    assert_equal things, Thing.paginate.all

    things = Thing.all(:limit => 11, :offset => 11)
    assert_equal things, Thing.paginate(:page => 2).all
  end

  def test_paginate_with_options
    things = Thing.all(:limit => 6)
    assert_equal things, Thing.paginate(:size => 5)

    things = Thing.all(:limit => 6, :offset => 6)
    assert_equal things, Thing.paginate(:size => 5, :page => 2)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
paginate-0.1.3 test/paginate/active_record_test.rb
paginate-0.1.2 test/paginate/active_record_test.rb
paginate-0.1.1 test/paginate/active_record_test.rb
paginate-0.1.0 test/paginate/active_record_test.rb