Sha256: 95a1ce616da3328ed8c660c7ddbd16fe788dd38cca7e812b6797612f982ca9e0
Contents?: true
Size: 797 Bytes
Versions: 6
Compression:
Stored size: 797 Bytes
Contents
require File.expand_path("../test_helper", __FILE__) class FulltextTest < AttrSearchable::TestCase def test_complex product1 = create(:product, :title => "word1") product2 = create(:product, :title => "word2 word3") product3 = create(:product, :title => "word2") results = Product.search("title:word1 OR (title:word2 -title:word3)") assert_includes results, product1 refute_includes results, product2 assert_includes results, product3 end def test_mixed expected = create(:product, :title => "Expected title", :stock => 1) rejected = create(:product, :title => "Expected title", :stock => 0) results = Product.search("title:Expected title:Title stock > 0") assert_includes results, expected refute_includes results, rejected end end
Version data entries
6 entries across 6 versions & 1 rubygems