Sha256: a4860d140a083562acf542237e22ca85b837cd980331a4fd05a641e7f9c5a8d5
Contents?: true
Size: 1.25 KB
Versions: 38
Compression:
Stored size: 1.25 KB
Contents
require_relative "test_helper" class SimilarTest < Minitest::Test def test_similar store_names ["Annie's Naturals Organic Shiitake & Sesame Dressing"] assert_search "Annie's Naturals Shiitake & Sesame Vinaigrette", ["Annie's Naturals Organic Shiitake & Sesame Dressing"], similar: true end def test_fields store_names ["1% Organic Milk", "2% Organic Milk", "Popcorn"] assert_equal ["2% Organic Milk"], Product.where(name: "1% Organic Milk").first.similar(fields: ["name"]).map(&:name) end def test_order store_names ["Lucerne Milk Chocolate Fat Free", "Clover Fat Free Milk"] assert_order "Lucerne Fat Free Chocolate Milk", ["Lucerne Milk Chocolate Fat Free", "Clover Fat Free Milk"], similar: true end def test_limit store_names ["1% Organic Milk", "2% Organic Milk", "Fat Free Organic Milk", "Popcorn"] assert_equal ["2% Organic Milk"], Product.where(name: "1% Organic Milk").first.similar(fields: ["name"], order: ["name"], limit: 1).map(&:name) end def test_per_page store_names ["1% Organic Milk", "2% Organic Milk", "Fat Free Organic Milk", "Popcorn"] assert_equal ["2% Organic Milk"], Product.where(name: "1% Organic Milk").first.similar(fields: ["name"], order: ["name"], per_page: 1).map(&:name) end end
Version data entries
38 entries across 38 versions & 3 rubygems