Sha256: 97af3fea94530d2e62ad95213ead215446cfbd3b36dfab43d437316dd7a9e2d3
Contents?: true
Size: 1.75 KB
Versions: 4
Compression:
Stored size: 1.75 KB
Contents
require File.dirname(__FILE__) + '/test_helper.rb' class TestSearchPagination < Test::Unit::TestCase def test_limit search = Account.new_search search.limit = 10 assert_equal 10, search.limit search.page = 2 assert_equal 10, search.offset search.limit = 25 assert_equal 25, search.offset assert_equal 2, search.page search.page = 5 assert_equal 5, search.page assert_equal 25, search.limit search.limit = 3 assert_equal 12, search.offset end def test_page search = Account.new_search(:per_page => nil) search.page = 2 assert_equal 1, search.page search.per_page = 20 assert_equal 2, search.page search.limit = 0 assert_equal 1, search.page search.per_page = 20 assert_equal 2, search.page search.limit = nil assert_equal 1, search.page end def test_per_page search = Account.new_search search.per_page = 10 assert_equal 10, search.per_page search.per_page = "" assert_equal nil, search.per_page search.per_page = 40 assert_equal 40, search.per_page search.per_page = nil assert_equal nil, search.per_page search.per_page = 60 assert_equal 60, search.per_page search.per_page = false assert_equal nil, search.per_page end def test_next_page end def test_prev_page end def test_page_count search = Account.new_search assert_equal 1, search.page_count search.per_page = 1 assert_equal 3, search.page_count search.per_page = 100 assert_equal 1, search.page_count Searchgasm::Config.search.per_page = 1 search = Account.new_search assert_equal 3, search.page_count search.conditions.users.first_name_contains assert_equal 3, search.page_count end end
Version data entries
4 entries across 4 versions & 1 rubygems