Skip to content

Commit 24db87e

Browse files
committed
Added more tests for JSON
1 parent 8ed58ec commit 24db87e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/relation_test.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,24 @@ def test_inspect
9090
assert_match "#<Searchkick::Relation [#<Product", Product.search("product").inspect
9191
end
9292

93+
def test_to_json
94+
store_names ["Product A", "Product B"]
95+
if mongoid?
96+
assert_equal Product.all.to_a.to_json, Product.search("product").to_json
97+
else
98+
assert_equal Product.all.to_json, Product.search("product").to_json
99+
end
100+
end
101+
102+
def test_as_json
103+
store_names ["Product A", "Product B"]
104+
if mongoid?
105+
assert_equal Product.all.to_a.as_json, Product.search("product").as_json
106+
else
107+
assert_equal Product.all.as_json, Product.search("product").as_json
108+
end
109+
end
110+
93111
def test_to_yaml
94112
store_names ["Product A", "Product B"]
95113
if mongoid?

0 commit comments

Comments
 (0)