diff options
author | Pat Nakajima <patnakajima@gmail.com> | 2009-02-08 11:36:01 -0500 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-02-13 21:37:03 +1300 |
commit | 0c956443964a20cbcc122e2d8c429b0cbb121828 (patch) | |
tree | 3d84889802d834a1846549782230a37860a0282d /railties/lib/rails_generator/generators/components/scaffold/templates | |
parent | 11b4a6d74d4bc2e988511318bd4504657c294901 (diff) | |
download | rails-0c956443964a20cbcc122e2d8c429b0cbb121828.tar.gz rails-0c956443964a20cbcc122e2d8c429b0cbb121828.tar.bz2 rails-0c956443964a20cbcc122e2d8c429b0cbb121828.zip |
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 <michael@koziarski.com>
[#1913 state:committed]
Diffstat (limited to 'railties/lib/rails_generator/generators/components/scaffold/templates')
-rw-r--r-- | railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb | 8 |
1 files changed, 4 insertions, 4 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 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 |