diff options
author | Prem Sichanugrist <s@sikachu.com> | 2011-04-10 12:38:59 +0800 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-04-10 16:47:52 +0800 |
commit | 22a3416298523d5e8ecb432a263e4bee9441e6c5 (patch) | |
tree | ecbe853fa81be36f3452b5b4cb5221086c0fd23b /railties/test | |
parent | 74960c3976a69b3c7d9aa6bf28edb42ea82df0ce (diff) | |
download | rails-22a3416298523d5e8ecb432a263e4bee9441e6c5.tar.gz rails-22a3416298523d5e8ecb432a263e4bee9441e6c5.tar.bz2 rails-22a3416298523d5e8ecb432a263e4bee9441e6c5.zip |
Add --old-style-hash option to force creating old style hash on Ruby 1.9
That means if you don't like the new syntax, you can pass --old-style-hash to force Rails to generate code with hash rockets.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 8 | ||||
-rw-r--r-- | railties/test/generators/scaffold_controller_generator_test.rb | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index e440885adf..43f2fbd71c 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -226,6 +226,14 @@ class AppGeneratorTest < Rails::Generators::TestCase end end end + + def test_force_old_style_hash + run_generator [destination_root, "--old-style-hash"] + assert_file "config/initializers/session_store.rb" do |file| + assert_match /config.session_store :cookie_store, :key => '_.+_session'/, file + end + end + protected def action(*args, &block) diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index ff82cdb744..c7f45a807d 100644 --- a/railties/test/generators/scaffold_controller_generator_test.rb +++ b/railties/test/generators/scaffold_controller_generator_test.rb @@ -133,4 +133,11 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase end end end + + def test_force_old_style_hash + run_generator ["User", "--old-style-hash"] + assert_file "app/controllers/users_controller.rb" do |content| + assert_match /\{ render :action => "new" \}/, content + end + end end |