diff options
author | Prem Sichanugrist <s@sikachu.com> | 2011-04-10 12:27:26 +0800 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-04-10 16:47:50 +0800 |
commit | 63cd92f9f346acefca1ad014873c971837843cdb (patch) | |
tree | 23be83a25e191359502ae7b95e83deee97ba93fe /railties/test/generators | |
parent | c0efc4009adb870ee23e93d46ac374f772d8cb4f (diff) | |
download | rails-63cd92f9f346acefca1ad014873c971837843cdb.tar.gz rails-63cd92f9f346acefca1ad014873c971837843cdb.tar.bz2 rails-63cd92f9f346acefca1ad014873c971837843cdb.zip |
Rails will now generate Ruby 1.9 style hash when running scaffold_controller generator on Ruby 1.9.x
The new hash syntax of Ruby 1.9 looks more superior, so we decide to switch to it in the places that appropriate.
This patch has been requested by DHH.
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/scaffold_controller_generator_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index d55ed22975..ff82cdb744 100644 --- a/railties/test/generators/scaffold_controller_generator_test.rb +++ b/railties/test/generators/scaffold_controller_generator_test.rb @@ -122,4 +122,15 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase ensure Unknown::Generators.send :remove_const, :ActiveModel end + + def test_new_hash_style + run_generator + assert_file "app/controllers/users_controller.rb" do |content| + if RUBY_VERSION < "1.9" + assert_match /\{ render :action => "new" \}/, content + else + assert_match /\{ render action: "new" \}/, content + end + end + end end |