I created a model and controller using scaffolding, and wrote some
unit tests that work fine. Now I want to do functional tests for the
controllers, and it turns out scaffolding is nice enough to write them
for me. But the test_create test fails, and I''ve got no clue why.
Here''s the test code:
def test_create
num_products = Product.count
post :create, :product => {}
assert_response :redirect
assert_redirected_to :action => ''list''
assert_equal num_products + 1, Product.count
end
And the error:
product_controller_test.rb:55:in `test_create'']:
Expected response to be a <:redirect>, but was <200>
So obviously the test checks to make sure it gets a redirect...but
it''s getting a 200 instead. I''ve got no clue why this is.
This is
brand new scaffolding code, which I thought should work out of the
box. Can anyone help me out? Thanks