1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix scaffold controller generator tests

This commit is contained in:
Carlos Antonio da Silva 2012-12-08 14:37:15 -02:00
parent 7d42317e3d
commit 1233fc6de1

View file

@ -20,17 +20,13 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
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 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
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