I have a test that is failing and I can't figure it out... it fails the
first time in autotest and the second time it runs (once autotest is
started), the test doesn't fail.
Thanks in advance for your help. Here is the test file:
class Admin::StoriesControllerTest < ActionController::TestCase
def first_story_form_attributes
s = stories(:one).attributes
s.delete("updated_at")
s.delete("created_at")
s.delete("id")
s
end
def test_should_not_update_story_admin
old_attributes = first_story_form_attributes
old_attributes[:headline] = ""
post :update, {:id => stories(:one).id, :record => old_attributes}
assert_response :success #THIS IS LINE 46
assert_select "div#errorExplanation" do
assert_select "li", :text => /Headline/
end
end
end
###END TEST FILE#####
####ERROR REPORTED:##### Here is the error:
1) Failure:
test_should_not_update_story_admin(Admin::StoriesControllerTest)
[./test/functional/admin/stories_controller_test.rb:46:in
`test_should_not_update_story_admin'
/Users/danderson/Projects/my_project/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/testing/default.rb:7:in
`run']:
Expected response to be a <:success>, but was <302>
Sorry, not much experience with scaffolding as I believe that it is next
to useless and only hampers you from getting your hands dirty and
figuring out the details of how rails handles MVC.