Sha256: 9f6aaa6d66ac983c551890b043418a95b40d3c40116e36efc5686d754d42fed6
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
require File.expand_path("../test_helper", __FILE__) class IntegerTest < AttrSearchable::TestCase def test_anywhere product = FactoryGirl.create(:product, :stock => 1) assert_includes Product.search("1"), product refute_includes Product.search("0"), product end def test_includes product = FactoryGirl.create(:product, :stock => 1) assert_includes Product.search("stock: 1"), product refute_includes Product.search("stock: 10"), product end def test_equals product = FactoryGirl.create(:product, :stock => 1) assert_includes Product.search("stock = 1"), product refute_includes Product.search("stock = 0"), product end def test_equals_not product = FactoryGirl.create(:product, :stock => 1) assert_includes Product.search("stock != 0"), product refute_includes Product.search("stock != 1"), product end def test_greater product = FactoryGirl.create(:product, :stock => 1) assert_includes Product.search("stock > 0"), product refute_includes Product.search("stock < 1"), product end def test_greater_equals product = FactoryGirl.create(:product, :stock => 1) assert_includes Product.search("stock >= 1"), product refute_includes Product.search("stock >= 2"), product end def test_less product = FactoryGirl.create(:product, :stock => 1) assert_includes Product.search("stock < 2"), product refute_includes Product.search("stock < 1"), product end def test_less_equals product = FactoryGirl.create(:product, :stock => 1) assert_includes Product.search("stock <= 1"), product refute_includes Product.search("stock <= 0"), product end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
attr_searchable-0.0.1 | test/integer_test.rb |