From 8e83a7e36c00d56b77a42ad8315201c8b1be2148 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Fri, 18 Feb 2022 16:57:10 -0800 Subject: [PATCH] Added test for array methods [skip ci] --- test/results_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+), 0 deletions(-) diff --git a/test/results_test.rb b/test/results_test.rb index 7e7044b..f8693d7 100644 --- a/test/results_test.rb +++ b/test/results_test.rb @@ -1,6 +1,19 @@ require_relative "test_helper" class ResultsTest < Minitest::Test + def test_array_methods + store_names ["Product A", "Product B"] + products = Product.search("product") + assert_equal 2, products.count + assert_equal 2, products.size + assert_equal 2, products.length + assert products.any? + refute products.empty? + assert_kind_of Product, products[0] + assert_kind_of Array, products.slice(0, 1) + assert_kind_of Array, products.to_ary + end + def test_with_hit store_names ["Product A", "Product B"] results = Product.search("product") -- libgit2 0.21.0