From 0c956443964a20cbcc122e2d8c429b0cbb121828 Mon Sep 17 00:00:00 2001 From: Pat Nakajima Date: Sun, 8 Feb 2009 11:36:01 -0500 Subject: Changed scaffold generated controller tests to use #to_param. Before, the generated controller tests were calling #id, which can change over time, making for brittle tests. Signed-off-by: Michael Koziarski [#1913 state:committed] --- .../generators/components/scaffold/templates/functional_test.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'railties/lib/rails_generator/generators/components/scaffold') 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 2d9d635944..cd2fc578bf 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 @@ -21,23 +21,23 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase end test "should show <%= file_name %>" do - get :show, :id => <%= table_name %>(:one).id + get :show, :id => <%= table_name %>(:one).to_param assert_response :success end test "should get edit" do - get :edit, :id => <%= table_name %>(:one).id + get :edit, :id => <%= table_name %>(:one).to_param assert_response :success end test "should update <%= file_name %>" do - put :update, :id => <%= table_name %>(:one).id, :<%= file_name %> => { } + put :update, :id => <%= table_name %>(:one).to_param, :<%= file_name %> => { } assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>)) end test "should destroy <%= file_name %>" do assert_difference('<%= class_name %>.count', -1) do - delete :destroy, :id => <%= table_name %>(:one).id + delete :destroy, :id => <%= table_name %>(:one).to_param end assert_redirected_to <%= table_name %>_path -- cgit v1.2.3