Skip to content

Commit

Permalink
Remove duplicates in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zkan committed Apr 7, 2024
1 parent 7e7d4ca commit 5110551
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/models/product_test.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
require "test_helper"

class ProductTest < ActiveSupport::TestCase
test "valid product" do
product = Product.new(
def setup
@product = Product.new(
name: "ODDS Whole Bean Coffee",
description: "Perfect start to your day",
price: 25.00,
)
assert product.valid?
end

test "valid product" do
assert @product.valid?
end

test "should not save product without name" do
product = Product.new
assert_not product.save
@product.name = nil
assert_not @product.valid?
end
end

0 comments on commit 5110551

Please sign in to comment.