Permalink
Browse files

Fix scaffold controller generator tests

  • Loading branch information...
1 parent 7d42317 commit 1233fc6de145932f3cd46c784ea78234cfa743b2 @carlosantoniodasilva carlosantoniodasilva committed Dec 8, 2012
Showing with 6 additions and 8 deletions.
  1. +6 −8 railties/test/generators/scaffold_controller_generator_test.rb
@@ -20,17 +20,13 @@ def test_controller_skeleton_is_created
assert_match(/@users = User\.all/, m)
end
- assert_instance_method :show, content do |m|
- assert_match(/@user = User\.find\(params\[:id\]\)/, m)
- end
+ assert_instance_method :show, content
assert_instance_method :new, content do |m|
assert_match(/@user = User\.new/, m)
end
- assert_instance_method :edit, content do |m|
- assert_match(/@user = User\.find\(params\[:id\]\)/, m)
- end
+ assert_instance_method :edit, content
assert_instance_method :create, content do |m|
assert_match(/@user = User\.new\(user_params\)/, m)
@@ -39,16 +35,18 @@ def test_controller_skeleton_is_created
end
assert_instance_method :update, content do |m|
- assert_match(/@user = User\.find\(params\[:id\]\)/, m)
assert_match(/@user\.update_attributes\(user_params\)/, m)
assert_match(/@user\.errors/, m)
end
assert_instance_method :destroy, content do |m|
- assert_match(/@user = User\.find\(params\[:id\]\)/, m)
assert_match(/@user\.destroy/, m)
end
+ assert_instance_method :set_user, content do |m|
+ assert_match(/@user = User\.find\(params\[:id\]\)/, m)
+ end
+
assert_match(/def user_params/, content)
assert_match(/params\.require\(:user\)\.permit\(:name, :age\)/, content)
end

0 comments on commit 1233fc6

Please sign in to comment.