我是Ruby on Rails中的新成員,現在我有點困惑。我運行了一個rake
測試並出現錯誤:錯誤的參數數量(1 of 0)
wrong argument number (1 of 0)
有人能幫助我嗎?我怎樣才能糾正參數號碼?請參閱下面的代碼。
test 'product price must be positive' do
product = Product.new(title: "My Book Title",
description: "yyy",
image_url: "zzz.jpg")
product.price = -1
assert product.invalid?
assert_equal ['must be greater than or equal to 0.01'],
product.errors[:price]
product.price = 0
assert product.invalid?
assert_equal ['must be greater than or equal to 0.01'],
product.errors[:price]
product.price = 1
assert product.valid?
錯誤的其餘部分是什麼意思? – sevenseacat