aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/test_unit
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-03-13 23:10:32 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-03-13 23:10:32 -0300
commit1ced5ca67bc553ebc4a8a1b3ba4776e882587600 (patch)
tree9ce6e410e799e133de74d93e8e95507166ab9610 /railties/lib/rails/generators/test_unit
parentec22a2b81356511b7613fcd41b693035a3cf5040 (diff)
downloadrails-1ced5ca67bc553ebc4a8a1b3ba4776e882587600.tar.gz
rails-1ced5ca67bc553ebc4a8a1b3ba4776e882587600.tar.bz2
rails-1ced5ca67bc553ebc4a8a1b3ba4776e882587600.zip
Remove key_value helper now that master is 1.9 only and we always use
the 1.9 hash syntax in the generators.
Diffstat (limited to 'railties/lib/rails/generators/test_unit')
-rw-r--r--railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb6
-rw-r--r--railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb10
2 files changed, 6 insertions, 10 deletions
diff --git a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb
index 8e796aada9..37b9f7ef7d 100644
--- a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb
+++ b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb
@@ -17,16 +17,12 @@ module TestUnit
private
- def resource_attributes
- key_value singular_table_name, "{ #{attributes_hash} }"
- end
-
def attributes_hash
return if accessible_attributes.empty?
accessible_attributes.map do |a|
name = a.name
- key_value name, "@#{singular_table_name}.#{name}"
+ "#{name}: @#{singular_table_name}.#{name}"
end.sort.join(', ')
end
diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
index 19894443d5..30e1650555 100644
--- a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
+++ b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
@@ -19,30 +19,30 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase
test "should create <%= singular_table_name %>" do
assert_difference('<%= class_name %>.count') do
- post :create, <%= resource_attributes %>
+ post :create, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
end
assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))
end
test "should show <%= singular_table_name %>" do
- get :show, <%= key_value :id, "@#{singular_table_name}" %>
+ get :show, id: <%= "@#{singular_table_name}" %>
assert_response :success
end
test "should get edit" do
- get :edit, <%= key_value :id, "@#{singular_table_name}" %>
+ get :edit, id: <%= "@#{singular_table_name}" %>
assert_response :success
end
test "should update <%= singular_table_name %>" do
- put :update, <%= key_value :id, "@#{singular_table_name}" %>, <%= resource_attributes %>
+ put :update, id: <%= "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))
end
test "should destroy <%= singular_table_name %>" do
assert_difference('<%= class_name %>.count', -1) do
- delete :destroy, <%= key_value :id, "@#{singular_table_name}" %>
+ delete :destroy, id: <%= "@#{singular_table_name}" %>
end
assert_redirected_to <%= index_helper %>_path