書籍「アジャイルWeb開発とレール」では、テストユニットケースの作成方法を教えています。
test "product price must be positive" do
product = Product.new(title: "By 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]
end
assert_equalステートメントに関して、「must bethan...」文字列の前後に角かっこが必要なのはなぜですか。ここでは変数の型が関係してくると思いますが、その理由を明確にする必要があります。
ありがとう。