aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb8
2 files changed, 6 insertions, 4 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index ff326224fe..164f60356e 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that functional tests generated for scaffolds should use fixture calls instead of hard-coded IDs #10435 [boone]
+
* Added db:migrate:redo and db:migrate:reset for rerunning existing migrations #10431, #10432 [matt]
* RAILS_GEM_VERSION may be double-quoted also. #10443 [James Cox]
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 b5df88f3b1..2b1f6520d9 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
def test_should_show_<%= file_name %>
- get :show, :id => 1
+ get :show, :id => <%= table_name %>(:one).id
assert_response :success
end
def test_should_get_edit
- get :edit, :id => 1
+ get :edit, :id => <%= table_name %>(:one).id
assert_response :success
end
def test_should_update_<%= file_name %>
- put :update, :id => 1, :<%= file_name %> => { }
+ put :update, :id => <%= table_name %>(:one).id, :<%= file_name %> => { }
assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
end
def test_should_destroy_<%= file_name %>
assert_difference('<%= class_name %>.count', -1) do
- delete :destroy, :id => 1
+ delete :destroy, :id => <%= table_name %>(:one).id
end
assert_redirected_to <%= table_name %>_path