Sha256: 5b08c87c82f2b85a0446ba2a7057906889c49192800c2ca4152ff88cbeef415e
Contents?: true
Size: 1005 Bytes
Versions: 1
Compression:
Stored size: 1005 Bytes
Contents
require File.expand_path("../test_helper", __FILE__) class AndTest < AttrSearchable::TestCase def test_and_string expected = FactoryGirl.create(:product, :title => "Expected title", :description => "Description") rejected = FactoryGirl.create(:product, :title => "Rejected title", :description => "Description") results = Product.search("title: 'Expected title' description: Description") assert_includes results, expected refute_includes results, rejected assert_equal results, Product.search("title: 'Expected title' AND description: Description") end def test_and_hash expected = FactoryGirl.create(:product, :title => "Expected title", :description => "Description") rejected = FactoryGirl.create(:product, :title => "Rejected title", :description => "Description") results = Product.search(:and => [{:title => "Expected title"}, {:description => "Description"}]) assert_includes results, expected refute_includes results, rejected end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
attr_searchable-0.0.1 | test/and_test.rb |