small medium large xlarge

Generic-user-small
15 Oct 2010, 07:06
Jon Mahoney (1 post)

Hello, I have a question about the example on p 210. I am following along with the examples and also attempting some modifications of the code to see what is possible. I attempted to change the following but it fails on the last scenario (with the first two passing but for the wrong reasons)

test “positive price” do product = Product.new(:title => products(:valid_product_attributes).title, :description => products(:valid_product_attributes).description, :image_url => products(:valid_product_attributes).image_url)

I think the fixture entry (:valid_product_attributes) is fine as I have used it successfully with other tests. I also tried to add the price into both a fixture entry and also just defining it but I get the same error on the last scenario ( is not true). So I know that in order for this to work I cannot use fixtures but my question is why is that the case?

Thanks in advance

You must be logged in to comment