Sha256: 2262a596a3b429de8dff423a4fcf8bd3fc8a19ed072d5c3a6cf81c3d08601506
Contents?: true
Size: 1.53 KB
Versions: 6
Compression:
Stored size: 1.53 KB
Contents
require File.expand_path("../test_helper", __FILE__) class BooleanTest < AttrSearchable::TestCase def test_mapping product = create(:product, :available => true) assert_includes Product.search("available: 1"), product assert_includes Product.search("available: true"), product assert_includes Product.search("available: yes"), product product = create(:product, :available => false) assert_includes Product.search("available: 0"), product assert_includes Product.search("available: false"), product assert_includes Product.search("available: no"), product end def test_anywhere product = create(:product, :available => true) assert_includes Product.search("true"), product refute_includes Product.search("false"), product end def test_includes product = create(:product, :available => true) assert_includes Product.search("available: true"), product refute_includes Product.search("available: false"), product end def test_equals product = create(:product, :available => true) assert_includes Product.search("available = true"), product refute_includes Product.search("available = false"), product end def test_equals_not product = create(:product, :available => false) assert_includes Product.search("available != true"), product refute_includes Product.search("available != false"), product end def test_incompatible_datatype assert_raises AttrSearchable::IncompatibleDatatype do Product.unsafe_search "available: Value" end end end
Version data entries
6 entries across 6 versions & 1 rubygems