Commit b759b2294d6742d5b046597cdb7cbd2a0a508a94
1 parent
fc3753fc
Exists in
master
and in
5 other branches
Better load test [skip ci]
Showing
1 changed file
with
7 additions
and
7 deletions
Show diff stats
test/load_test.rb
1 | require_relative "test_helper" | 1 | require_relative "test_helper" |
2 | 2 | ||
3 | class LoadTest < Minitest::Test | 3 | class LoadTest < Minitest::Test |
4 | - def test_load_default | 4 | + def test_default |
5 | store_names ["Product A"] | 5 | store_names ["Product A"] |
6 | assert_kind_of Product, Product.search("product").first | 6 | assert_kind_of Product, Product.search("product").first |
7 | end | 7 | end |
8 | 8 | ||
9 | - def test_load_false | 9 | + def test_false |
10 | store_names ["Product A"] | 10 | store_names ["Product A"] |
11 | - assert_kind_of Hash, Product.search("product", load: false).first | 11 | + assert_kind_of Searchkick::HashWrapper, Product.search("product", load: false).first |
12 | end | 12 | end |
13 | 13 | ||
14 | - def test_load_false_methods | 14 | + def test_false_methods |
15 | store_names ["Product A"] | 15 | store_names ["Product A"] |
16 | assert_equal "Product A", Product.search("product", load: false).first.name | 16 | assert_equal "Product A", Product.search("product", load: false).first.name |
17 | end | 17 | end |
18 | 18 | ||
19 | - def test_load_false_with_includes | 19 | + def test_false_with_includes |
20 | store_names ["Product A"] | 20 | store_names ["Product A"] |
21 | - assert_kind_of Hash, Product.search("product", load: false, includes: [:store]).first | 21 | + assert_kind_of Searchkick::HashWrapper, Product.search("product", load: false, includes: [:store]).first |
22 | end | 22 | end |
23 | 23 | ||
24 | - def test_load_false_nested_object | 24 | + def test_false_nested_object |
25 | aisle = {"id" => 1, "name" => "Frozen"} | 25 | aisle = {"id" => 1, "name" => "Frozen"} |
26 | store [{name: "Product A", aisle: aisle}] | 26 | store [{name: "Product A", aisle: aisle}] |
27 | assert_equal aisle, Product.search("product", load: false).first.aisle.to_hash | 27 | assert_equal aisle, Product.search("product", load: false).first.aisle.to_hash |