Commit 8e83a7e36c00d56b77a42ad8315201c8b1be2148
1 parent
f457f5fa
Exists in
master
and in
2 other branches
Added test for array methods [skip ci]
Showing
1 changed file
with
13 additions
and
0 deletions
Show diff stats
test/results_test.rb
1 | 1 | require_relative "test_helper" |
2 | 2 | |
3 | 3 | class ResultsTest < Minitest::Test |
4 | + def test_array_methods | |
5 | + store_names ["Product A", "Product B"] | |
6 | + products = Product.search("product") | |
7 | + assert_equal 2, products.count | |
8 | + assert_equal 2, products.size | |
9 | + assert_equal 2, products.length | |
10 | + assert products.any? | |
11 | + refute products.empty? | |
12 | + assert_kind_of Product, products[0] | |
13 | + assert_kind_of Array, products.slice(0, 1) | |
14 | + assert_kind_of Array, products.to_ary | |
15 | + end | |
16 | + | |
4 | 17 | def test_with_hit |
5 | 18 | store_names ["Product A", "Product B"] |
6 | 19 | results = Product.search("product") | ... | ... |