diff options
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 | 18 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml | 2 |
2 files changed, 10 insertions, 10 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 32185fb715..ea9c8e4e94 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 @@ -8,9 +8,9 @@ class <%= controller_class_name %>ControllerTest < Test::Unit::TestCase fixtures :<%= table_name %> def setup + $base_id = 1000001 @controller = <%= controller_class_name %>Controller.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new end <% for action in unscaffolded_actions -%> @@ -34,7 +34,7 @@ class <%= controller_class_name %>ControllerTest < Test::Unit::TestCase end def test_show<%= suffix %> - process :show<%= suffix %>, 'id' => 1 + process :show<%= suffix %>, 'id' => $base_id assert_rendered_file 'show' assert_template_has '<%= singular_name %>' assert_valid_record '<%= singular_name %>' @@ -56,25 +56,25 @@ class <%= controller_class_name %>ControllerTest < Test::Unit::TestCase end def test_edit<%= suffix %> - process :edit<%= suffix %>, 'id' => 1 + process :edit<%= suffix %>, 'id' => $base_id assert_rendered_file 'edit<%= suffix %>' assert_template_has '<%= singular_name %>' assert_valid_record '<%= singular_name %>' end def test_update<%= suffix %> - process :update<%= suffix %>, '<%= singular_name %>' => { 'id' => 1 } - assert_redirected_to :action => 'show<%= suffix %>', :id => 1 + process :update<%= suffix %>, '<%= singular_name %>' => { 'id' => $base_id } + assert_redirected_to :action => 'show<%= suffix %>', :id => $base_id end def test_destroy<%= suffix %> - assert_not_nil <%= class_name %>.find(1) + assert_not_nil <%= class_name %>.find($base_id) - process :destroy, 'id' => 1 + process :destroy, 'id' => $base_id assert_redirected_to :action => 'list<%= suffix %>' assert_raise(ActiveRecord::RecordNotFound) { - <%= singular_name %> = <%= class_name %>.find(1) + <%= singular_name %> = <%= class_name %>.find($base_id) } end end diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml b/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml index e0d56d1122..068fd67472 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml @@ -10,7 +10,7 @@ <%% for <%= singular_name %> in @<%= plural_name %> %> <tr> <%% for column in <%= class_name %>.content_columns %> - <td><%%=h <%= singular_name %>.send(column.name) %></td> + <td><%%=h <%= singular_name %>[column.name] %></td> <%% end %> <td><%%= link_to 'Show', :action => 'show<%= suffix %>', :id => <%= singular_name %>.id %></td> <td><%%= link_to 'Edit', :action => 'edit<%= suffix %>', :id => <%= singular_name %>.id %></td> |