mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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
This commit is contained in:
parent
def8f101b8
commit
43cd97e7fa
2 changed files with 8 additions and 6 deletions
|
@ -1,5 +1,7 @@
|
|||
*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 @@ class <%= controller_class_name %>ControllerTest < Test::Unit::TestCase
|
|||
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 @@ class <%= controller_class_name %>ControllerTest < Test::Unit::TestCase
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue