Sha256: 6657f5324b0edd243a748c263fccdbb6e164374739174b3a685a9fd4049d9ea4
Contents?: true
Size: 957 Bytes
Versions: 6
Compression:
Stored size: 957 Bytes
Contents
require File.expand_path("../test_helper", __FILE__) class AndTest < AttrSearchable::TestCase def test_and_string expected = create(:product, :title => "Expected title", :description => "Description") rejected = 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 = create(:product, :title => "Expected title", :description => "Description") rejected = 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
6 entries across 6 versions & 1 rubygems