Sha256: 4b5f2eb2c28fa223c679c4688428004846b4415b3b3332fb8f9367a20f753f98

Contents?: true

Size: 625 Bytes

Versions: 2

Compression:

Stored size: 625 Bytes

Contents

require 'integration_test_helper.rb'

class WillPaginateSearchTest < ActiveSupport::TestCase
  fixtures :posts

  def teardown
    # need to do this to work with the :if Proc tests.
    Post.acts_as_indexed :fields => [:title, :body]
    destroy_index
  end

  def test_paginate_search

    assert_equal [5, 2, 1, 3, 6, 4], paginate_search(1, 10)
    assert_equal [5, 2, 1], paginate_search(1, 3)
    assert_equal [3, 6, 4], paginate_search(2, 3)
  end

  private

  # Returns relevant IDs.
  def paginate_search(page, per_page)
    Post.paginate_search('^c', :page => page, :per_page => per_page).map { |p| p.id }
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acts_as_indexed-0.8.3 test/integration/will_paginate_search_test.rb
acts_as_indexed-0.8.2 test/integration/will_paginate_search_test.rb