test/index_test.rb in searchkick-0.8.7 vs test/index_test.rb in searchkick-0.9.0
- old
+ new
@@ -73,27 +73,35 @@
end
def test_bad_mapping
Product.searchkick_index.delete
store_names ["Product A"]
- assert_raises(Searchkick::InvalidQueryError){ Product.search "test" }
+ assert_raises(Searchkick::InvalidQueryError) { Product.search "test" }
ensure
Product.reindex
end
+ def test_remove_blank_id
+ store_names ["Product A"]
+ Product.searchkick_index.remove(OpenStruct.new)
+ assert_search "product", ["Product A"]
+ ensure
+ Product.reindex
+ end
+
def test_missing_index
- assert_raises(Searchkick::MissingIndexError){ Product.search "test", index_name: "not_found" }
+ assert_raises(Searchkick::MissingIndexError) { Product.search "test", index_name: "not_found" }
end
def test_unsupported_version
- raises_exception = lambda { |s| raise Elasticsearch::Transport::Transport::Error.new("[500] No query registered for [multi_match]") }
+ raises_exception = ->(s) { raise Elasticsearch::Transport::Transport::Error.new("[500] No query registered for [multi_match]") }
Searchkick.client.stub :search, raises_exception do
- assert_raises(Searchkick::UnsupportedVersionError){ Product.search("test") }
+ assert_raises(Searchkick::UnsupportedVersionError) { Product.search("test") }
end
end
def test_invalid_query
- assert_raises(Searchkick::InvalidQueryError){ Product.search(query: {}) }
+ assert_raises(Searchkick::InvalidQueryError) { Product.search(query: {}) }
end
if defined?(ActiveRecord)
def test_transaction