diff options
author | José Valim <jose.valim@gmail.com> | 2012-03-14 12:42:08 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-03-14 12:42:08 -0700 |
commit | 25861e22a1174fe5c8f789bb2bf112aaef947f32 (patch) | |
tree | b971d22c24c3d7da6589bf555453f2ea396cc6f2 /railties/test | |
parent | 35262b7cd2917017cb158e6427d1007089489d33 (diff) | |
parent | 2963ee6b4bbdb288de8a1245d4fbaa67dd256139 (diff) | |
download | rails-25861e22a1174fe5c8f789bb2bf112aaef947f32.tar.gz rails-25861e22a1174fe5c8f789bb2bf112aaef947f32.tar.bz2 rails-25861e22a1174fe5c8f789bb2bf112aaef947f32.zip |
Merge pull request #5439 from carlosantoniodasilva/rake-test-scaffold
Fix scaffold controller template and ensure rake test for scaffold works
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/rake_test.rb | 25 | ||||
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 7 |
2 files changed, 29 insertions, 3 deletions
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 diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index dc52c79fb5..ac4c2abfc8 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -116,7 +116,12 @@ module TestHelpers end end - add_to_config 'config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"; config.session_store :cookie_store, :key => "_myapp_session"; config.active_support.deprecation = :log' + add_to_config <<-RUBY + config.secret_token = "3b7cd727ee24e8444053437c36cc66c4" + config.session_store :cookie_store, :key => "_myapp_session" + config.active_support.deprecation = :log + config.action_controller.allow_forgery_protection = false + RUBY end def teardown_app |