Commit 915939df7baee5ebb69405306d770670927b9f0f

Authored by Andrew Kane
1 parent 7b1e6fe2

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,7 +95,7 @@ class SqlTest < Minitest::Test
95 result = Product.search("product", load: false, select: :name).first 95 result = Product.search("product", load: false, select: :name).first
96 assert_equal %w(id name), result.keys.reject { |k| k.start_with?("_") }.sort 96 assert_equal %w(id name), result.keys.reject { |k| k.start_with?("_") }.sort
97 assert_equal ["Product A"], result.name 97 assert_equal ["Product A"], result.name
98 - assert_equal nil, result.store_id 98 + assert_nil result.store_id
99 end 99 end
100 100
101 def test_select_all 101 def test_select_all
@@ -108,8 +108,7 @@ class SqlTest < Minitest::Test @@ -108,8 +108,7 @@ class SqlTest < Minitest::Test
108 def test_select_none 108 def test_select_none
109 store [{name: "Product A", user_ids: [1, 2]}] 109 store [{name: "Product A", user_ids: [1, 2]}]
110 hit = Product.search("product", select: []).hits.first 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 end 112 end
114 113
115 # source_select 114 # source_select
@@ -133,7 +132,7 @@ class SqlTest < Minitest::Test @@ -133,7 +132,7 @@ class SqlTest < Minitest::Test
133 result = Product.search("product", load: false, source_select: :name).first 132 result = Product.search("product", load: false, source_select: :name).first
134 assert_equal %w(id name), result.keys.reject { |k| k.start_with?("_") }.sort 133 assert_equal %w(id name), result.keys.reject { |k| k.start_with?("_") }.sort
135 assert_equal "Product A", result.name 134 assert_equal "Product A", result.name
136 - assert_equal nil, result.store_id 135 + assert_nil result.store_id
137 end 136 end
138 137
139 def test_source_select_all 138 def test_source_select_all
@@ -146,8 +145,7 @@ class SqlTest < Minitest::Test @@ -146,8 +145,7 @@ class SqlTest < Minitest::Test
146 def test_source_select_none 145 def test_source_select_none
147 store [{name: "Product A", user_ids: [1, 2]}] 146 store [{name: "Product A", user_ids: [1, 2]}]
148 hit = Product.search("product", source_select: []).hits.first 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 end 149 end
152 150
153 # other tests 151 # other tests