diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-12-08 14:37:15 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-12-08 14:37:15 -0200 |
commit | 1233fc6de145932f3cd46c784ea78234cfa743b2 (patch) | |
tree | 19422dc7117d2aab006e2f0c8471d52ecd793f75 /railties | |
parent | 7d42317e3dad0a9045dbe1fc64270e03433b1d7c (diff) | |
download | rails-1233fc6de145932f3cd46c784ea78234cfa743b2.tar.gz rails-1233fc6de145932f3cd46c784ea78234cfa743b2.tar.bz2 rails-1233fc6de145932f3cd46c784ea78234cfa743b2.zip |
Fix scaffold controller generator tests
Diffstat (limited to 'railties')
-rw-r--r-- | railties/test/generators/scaffold_controller_generator_test.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index 8cacca668f..2a88dac635 100644 --- a/railties/test/generators/scaffold_controller_generator_test.rb +++ b/railties/test/generators/scaffold_controller_generator_test.rb @@ -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 |