Sha256: 514a5885a00c9a15fea2e159d92a2523133e654ddca1934f4ec200db64537051

Contents?: true

Size: 786 Bytes

Versions: 6

Compression:

Stored size: 786 Bytes

Contents

require File.expand_path("../test_helper", __FILE__)

class NotTest < AttrSearchable::TestCase
  def test_not_string
    expected = create(:product, :title => "Expected title")
    rejected = create(:product, :title => "Rejected title")

    results = Product.search("title: Title NOT title: Rejected")

    assert_includes results, expected
    refute_includes results, rejected

    assert_equal results, Product.search("title: Title -title: Rejected")
  end

  def test_not_hash
    expected = create(:product, :title => "Expected title")
    rejected = create(:product, :title => "Rejected title")

    results = Product.search(:and => [{:title => "Title"}, {:not => {:title => "Rejected"}}])

    assert_includes results, expected
    refute_includes results, rejected
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
attr_searchable-0.0.7 test/not_test.rb
attr_searchable-0.0.6 test/not_test.rb
attr_searchable-0.0.5 test/not_test.rb
attr_searchable-0.0.4 test/not_test.rb
attr_searchable-0.0.3 test/not_test.rb
attr_searchable-0.0.2 test/not_test.rb