From 2963ee6b4bbdb288de8a1245d4fbaa67dd256139 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Wed, 14 Mar 2012 14:36:15 -0300 Subject: Fix scaffold controller template, ensure rake scaffold test pass by default --- railties/test/application/rake_test.rb | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'railties/test/application') diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index fed9dce8e1..545020357a 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -123,12 +123,33 @@ module ApplicationTests end def test_scaffold_tests_pass_by_default - content = Dir.chdir(app_path) do + output = Dir.chdir(app_path) do `rails generate scaffold user username:string password:string; bundle exec rake db:migrate db:test:clone test` end - assert_match(/\d+ tests, \d+ assertions, 0 failures, 0 errors/, content) + assert_match(/7 tests, 13 assertions, 0 failures, 0 errors/, output) + assert_no_match(/Errors running/, output) + end + + def test_http_scaffold_tests_pass_by_default + add_to_config <<-RUBY + config.middleware.http_only! + config.generators.http_only! + RUBY + + app_file "app/controllers/application_controller.rb", <<-RUBY + class ApplicationController < ActionController::HTTP + end + RUBY + + output = Dir.chdir(app_path) do + `rails generate scaffold user username:string password:string; + bundle exec rake db:migrate db:test:clone test` + end + + assert_match(/6 tests, 12 assertions, 0 failures, 0 errors/, output) + assert_no_match(/Errors running/, output) end def test_rake_dump_structure_should_respect_db_structure_env_variable -- cgit v1.2.3