The book solution demos adding an @update product not conflicting with the default fixtures :one and :two, which by default have the same title. (after adding uniqueness test on title, these fail).
It also works to fix the test data, just update the products.yml file and provide a unique title for :one and :two
one:
title: MyString One
description: MyText
image_url: MyString
price: 9.99
two:
title: MyString Two
description: MyText
image_url: MyString
price: 9.99
This allows the update test to pass no problem.
Note: you do still need to provide a unique title in should create product (where using :one as a template). Simple as adding one line into the method:
#after validation added, now required to provide a unique title.
@product.title="a unique test title"
#this is the part that takes the form input..
post :create, :product => @product.attributes
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment