From 72c1865549a9ae3fb1a65f083e53713d2aed1f43 Mon Sep 17 00:00:00 2001 From: zkan Date: Sun, 7 Apr 2024 18:12:23 +0700 Subject: [PATCH] Use fixtures for products --- test/fixtures/products.yml | 13 ++++--------- test/models/product_test.rb | 6 +----- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/test/fixtures/products.yml b/test/fixtures/products.yml index 78a46ce..2b0de69 100644 --- a/test/fixtures/products.yml +++ b/test/fixtures/products.yml @@ -1,11 +1,6 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -one: - name: MyString - description: MyString - price: 1.5 - -two: - name: MyString - description: MyString - price: 1.5 +valid: + name: "ODDS Whole Bean Coffee" + description: "Perfect start to your day" + price: 25.00 diff --git a/test/models/product_test.rb b/test/models/product_test.rb index 6c47465..dd1912c 100644 --- a/test/models/product_test.rb +++ b/test/models/product_test.rb @@ -2,11 +2,7 @@ class ProductTest < ActiveSupport::TestCase def setup - @product = Product.new( - name: "ODDS Whole Bean Coffee", - description: "Perfect start to your day", - price: 25.00, - ) + @product = products(:valid) end test "valid product" do