From ac8469d233821899283bcb7e6b0cd8d4203ffb35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 12 Mar 2012 20:10:40 -0300 Subject: Use the attributes hash explicitly --- railties/test/generators/scaffold_generator_test.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'railties/test/generators/scaffold_generator_test.rb') diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index d983ae8b49..f4f0147156 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -64,9 +64,8 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase assert_file "test/functional/product_lines_controller_test.rb" do |test| assert_match(/class ProductLinesControllerTest < ActionController::TestCase/, test) - assert_match(/@valid_attributes = @product_line\.attributes\.slice\("title"\)/, test) - assert_match(/post :create, product_line: @valid_attributes/, test) - assert_match(/put :update, id: @product_line, product_line: @valid_attributes/, test) + assert_match(/post :create, product_line: { title: @product_line.title }/, test) + assert_match(/put :update, id: @product_line, product_line: { title: @product_line.title }/, test) end # Views @@ -89,6 +88,17 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase assert_file "app/assets/stylesheets/product_lines.css" end + def test_functional_tests_without_attributes + run_generator ["product_line"] + + assert_file "test/functional/product_lines_controller_test.rb" do |content| + assert_match(/class ProductLinesControllerTest < ActionController::TestCase/, content) + assert_match(/test "should get index"/, content) + assert_match(/post :create, product_line: { }/, content) + assert_match(/put :update, id: @product_line, product_line: { }/, content) + end + end + def test_scaffold_on_revoke run_generator run_generator ["product_line"], :behavior => :revoke -- cgit v1.2.3