diff options
Diffstat (limited to 'railties/test/generators/scaffold_controller_generator_test.rb')
-rw-r--r-- | railties/test/generators/scaffold_controller_generator_test.rb | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index f13305adb0..c34ce285e3 100644 --- a/railties/test/generators/scaffold_controller_generator_test.rb +++ b/railties/test/generators/scaffold_controller_generator_test.rb @@ -31,12 +31,10 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase assert_instance_method :create, content do |m| assert_match(/@user = User\.new\(user_params\)/, m) assert_match(/@user\.save/, m) - assert_match(/@user\.errors/, m) end assert_instance_method :update, content do |m| - assert_match(/@user\.update_attributes\(user_params\)/, m) - assert_match(/@user\.errors/, m) + assert_match(/@user\.update\(user_params\)/, m) end assert_instance_method :destroy, content do |m| @@ -101,7 +99,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase assert_match(/class UsersControllerTest < ActionController::TestCase/, content) assert_match(/test "should get index"/, content) assert_match(/post :create, user: \{ age: @user\.age, name: @user\.name, organization_id: @user\.organization_id, organization_type: @user\.organization_type \}/, content) - assert_match(/put :update, id: @user, user: \{ age: @user\.age, name: @user\.name, organization_id: @user\.organization_id, organization_type: @user\.organization_type \}/, content) + assert_match(/patch :update, id: @user, user: \{ age: @user\.age, name: @user\.name, organization_id: @user\.organization_id, organization_type: @user\.organization_type \}/, content) end end @@ -112,7 +110,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase assert_match(/class UsersControllerTest < ActionController::TestCase/, content) assert_match(/test "should get index"/, content) assert_match(/post :create, user: \{ \}/, content) - assert_match(/put :update, id: @user, user: \{ \}/, content) + assert_match(/patch :update, id: @user, user: \{ \}/, content) end end @@ -127,18 +125,6 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase assert_no_file "app/views/layouts/users.html.erb" end - def test_skip_html_if_required - run_generator [ "User", "name:string", "age:integer", "--no-html" ] - assert_no_file "app/helpers/users_helper.rb" - assert_no_file "app/views/users" - - assert_file "app/controllers/users_controller.rb" do |content| - assert_no_match(/format\.html/, content) - assert_no_match(/def edit/, content) - assert_no_match(/def new/, content) - end - end - def test_default_orm_is_used run_generator ["User", "--orm=unknown"] @@ -176,7 +162,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase def test_new_hash_style run_generator assert_file "app/controllers/users_controller.rb" do |content| - assert_match(/\{ render action: "new" \}/, content) + assert_match(/render action: 'new'/, content) end end end |