Sha256: a9b21b6a6492c516a1d8d57766d1d4db679186915baac8cac9ac199234ff0c56

Contents?: true

Size: 679 Bytes

Versions: 2

Compression:

Stored size: 679 Bytes

Contents

require_relative '../../../test_helper'

class DocumentTest < ActiveSupport::TestCase
  fixtures :documents

  setup do
    Document.reindex!
  end

  test "Search document" do
    result = Document.search do
      fulltext 'document'
      with(:room_id, 42)
      without(:room_id, 43)
      paginate page: 1, per_page: 10
      order_by :score, :desc
      order_by :id
    end
    assert result.length == 2, 'The number of document returned is wrong'
  end

  test "Suggestion" do
    result = Document.search do
      fulltext 'An' do
        fields('name|suggestion')
      end
    end
    assert result.length == 1, 'The number of returned suggestion is wrong'
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oss_active_record-0.3.1 test/dummy/test/models/document_test.rb
oss_active_record-0.3.0 test/dummy/test/models/document_test.rb