diff options
Diffstat (limited to 'railties/lib/rails_generator')
-rw-r--r-- | railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb b/railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb index 0c68fd3122..7619b04dc3 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb @@ -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 |