提交 43cd97e7 编写于 作者: J Jeremy Kemper

Generated scaffold functional tests use assert_difference. Closes #8421.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6808 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 def8f101
*SVN*
* Generated scaffold functional tests use assert_difference. #8421 [norbert]
* Update to Prototype 1.5.1. [Sam Stephenson]
* Update to script.aculo.us 1.7.1_beta3. [Thomas Fuchs]
......
......@@ -25,9 +25,9 @@ def test_should_get_new
end
def test_should_create_<%= file_name %>
old_count = <%= class_name %>.count
post :create, :<%= file_name %> => { }
assert_equal old_count+1, <%= class_name %>.count
assert_difference('<%= class_name %>.count') do
post :create, :<%= file_name %> => { }
end
assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
end
......@@ -48,9 +48,9 @@ def test_should_update_<%= file_name %>
end
def test_should_destroy_<%= file_name %>
old_count = <%= class_name %>.count
delete :destroy, :id => 1
assert_equal old_count-1, <%= class_name %>.count
assert_difference('<%= class_name %>.count', -1) do
delete :destroy, :id => 1
end
assert_redirected_to <%= table_name %>_path
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册