aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-12-07 20:35:43 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-12-07 20:35:43 -0500
commitcd526fe4258da0f4acf0d69f37982eba7de9ee1c (patch)
tree4332f4a1e03a3a1c636b9c4a9bb321f946b0087a /railties/test
parenta3c29b70a9ec6696e76ba5a6e5ef856d31b3a427 (diff)
downloadrails-cd526fe4258da0f4acf0d69f37982eba7de9ee1c.tar.gz
rails-cd526fe4258da0f4acf0d69f37982eba7de9ee1c.tar.bz2
rails-cd526fe4258da0f4acf0d69f37982eba7de9ee1c.zip
fix scaffold controller generator tests
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/generators/scaffold_generator_test.rb28
1 files changed, 12 insertions, 16 deletions
diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb
index 54d5a9db6f..7fcc0a7409 100644
--- a/railties/test/generators/scaffold_generator_test.rb
+++ b/railties/test/generators/scaffold_generator_test.rb
@@ -30,17 +30,13 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
assert_match(/@product_lines = ProductLine\.all/, m)
end
- assert_instance_method :show, content do |m|
- assert_match(/@product_line = ProductLine\.find\(params\[:id\]\)/, m)
- end
+ assert_instance_method :show, content
assert_instance_method :new, content do |m|
assert_match(/@product_line = ProductLine\.new/, m)
end
- assert_instance_method :edit, content do |m|
- assert_match(/@product_line = ProductLine\.find\(params\[:id\]\)/, m)
- end
+ assert_instance_method :edit, content
assert_instance_method :create, content do |m|
assert_match(/@product_line = ProductLine\.new\(product_line_params\)/, m)
@@ -49,15 +45,17 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
end
assert_instance_method :update, content do |m|
- assert_match(/@product_line = ProductLine\.find\(params\[:id\]\)/, m)
assert_match(/@product_line\.update_attributes\(product_line_params\)/, m)
assert_match(/@product_line\.errors/, m)
end
assert_instance_method :destroy, content do |m|
- assert_match(/@product_line = ProductLine\.find\(params\[:id\]\)/, m)
assert_match(/@product_line\.destroy/, m)
end
+
+ assert_instance_method :set_product_line, content do |m|
+ assert_match(/@product_line = ProductLine\.find\(params\[:id\]\)/, m)
+ end
end
assert_file "test/controllers/product_lines_controller_test.rb" do |test|
@@ -149,17 +147,13 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
assert_match(/@admin_roles = Admin::Role\.all/, m)
end
- assert_instance_method :show, content do |m|
- assert_match(/@admin_role = Admin::Role\.find\(params\[:id\]\)/, m)
- end
+ assert_instance_method :show, content
assert_instance_method :new, content do |m|
assert_match(/@admin_role = Admin::Role\.new/, m)
end
- assert_instance_method :edit, content do |m|
- assert_match(/@admin_role = Admin::Role\.find\(params\[:id\]\)/, m)
- end
+ assert_instance_method :edit, content
assert_instance_method :create, content do |m|
assert_match(/@admin_role = Admin::Role\.new\(admin_role_params\)/, m)
@@ -168,15 +162,17 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
end
assert_instance_method :update, content do |m|
- assert_match(/@admin_role = Admin::Role\.find\(params\[:id\]\)/, m)
assert_match(/@admin_role\.update_attributes\(admin_role_params\)/, m)
assert_match(/@admin_role\.errors/, m)
end
assert_instance_method :destroy, content do |m|
- assert_match(/@admin_role = Admin::Role\.find\(params\[:id\]\)/, m)
assert_match(/@admin_role\.destroy/, m)
end
+
+ assert_instance_method :set_admin_role, content do |m|
+ assert_match(/@admin_role = Admin::Role\.find\(params\[:id\]\)/, m)
+ end
end
assert_file "test/controllers/admin/roles_controller_test.rb",