Commit 915939df7baee5ebb69405306d770670927b9f0f
1 parent
7b1e6fe2
Exists in
master
and in
21 other branches
Use assert_nil
Showing
1 changed file
with
4 additions
and
6 deletions
Show diff stats
test/sql_test.rb
... | ... | @@ -95,7 +95,7 @@ class SqlTest < Minitest::Test |
95 | 95 | result = Product.search("product", load: false, select: :name).first |
96 | 96 | assert_equal %w(id name), result.keys.reject { |k| k.start_with?("_") }.sort |
97 | 97 | assert_equal ["Product A"], result.name |
98 | - assert_equal nil, result.store_id | |
98 | + assert_nil result.store_id | |
99 | 99 | end |
100 | 100 | |
101 | 101 | def test_select_all |
... | ... | @@ -108,8 +108,7 @@ class SqlTest < Minitest::Test |
108 | 108 | def test_select_none |
109 | 109 | store [{name: "Product A", user_ids: [1, 2]}] |
110 | 110 | hit = Product.search("product", select: []).hits.first |
111 | - assert_equal hit["_source"], nil | |
112 | - assert_equal hit["_source"], nil | |
111 | + assert_nil hit["_source"] | |
113 | 112 | end |
114 | 113 | |
115 | 114 | # source_select |
... | ... | @@ -133,7 +132,7 @@ class SqlTest < Minitest::Test |
133 | 132 | result = Product.search("product", load: false, source_select: :name).first |
134 | 133 | assert_equal %w(id name), result.keys.reject { |k| k.start_with?("_") }.sort |
135 | 134 | assert_equal "Product A", result.name |
136 | - assert_equal nil, result.store_id | |
135 | + assert_nil result.store_id | |
137 | 136 | end |
138 | 137 | |
139 | 138 | def test_source_select_all |
... | ... | @@ -146,8 +145,7 @@ class SqlTest < Minitest::Test |
146 | 145 | def test_source_select_none |
147 | 146 | store [{name: "Product A", user_ids: [1, 2]}] |
148 | 147 | hit = Product.search("product", source_select: []).hits.first |
149 | - assert_equal hit["_source"], nil | |
150 | - assert_equal hit["_source"], nil | |
148 | + assert_nil hit["_source"] | |
151 | 149 | end |
152 | 150 | |
153 | 151 | # other tests | ... | ... |