From 5ad7f8ab418f0c760dbb584f7c78d94ce32e9ee3 Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Sun, 14 Oct 2012 12:03:39 +0200 Subject: Use Ruby 1.9 Hash syntax in railties --- railties/test/application/generators_test.rb | 30 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'railties/test/application/generators_test.rb') diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index b80244f1d2..bc0af499c1 100644 --- a/railties/test/application/generators_test.rb +++ b/railties/test/application/generators_test.rb @@ -48,22 +48,22 @@ module ApplicationTests c.generators.orm = :data_mapper c.generators.test_framework = :rspec c.generators.helper = false - expected = { :rails => { :orm => :data_mapper, :test_framework => :rspec, :helper => false } } + expected = { rails: { orm: :data_mapper, test_framework: :rspec, helper: false } } assert_equal(expected, c.generators.options) end end test "generators set rails aliases" do with_config do |c| - c.generators.aliases = { :rails => { :test_framework => "-w" } } - expected = { :rails => { :test_framework => "-w" } } + c.generators.aliases = { rails: { test_framework: "-w" } } + expected = { rails: { test_framework: "-w" } } assert_equal expected, c.generators.aliases end end test "generators aliases, options, templates and fallbacks on initialization" do add_to_config <<-RUBY - config.generators.rails :aliases => { :test_framework => "-w" } + config.generators.rails aliases: { test_framework: "-w" } config.generators.orm :data_mapper config.generators.test_framework :rspec config.generators.fallbacks[:shoulda] = :test_unit @@ -76,7 +76,7 @@ module ApplicationTests assert_equal :rspec, Rails::Generators.options[:rails][:test_framework] assert_equal "-w", Rails::Generators.aliases[:rails][:test_framework] - assert_equal Hash[:shoulda => :test_unit], Rails::Generators.fallbacks + assert_equal Hash[shoulda: :test_unit], Rails::Generators.fallbacks assert_equal ["some/where"], Rails::Generators.templates_path end @@ -95,31 +95,31 @@ module ApplicationTests test "generators with hashes for options and aliases" do with_bare_config do |c| c.generators do |g| - g.orm :data_mapper, :migration => false - g.plugin :aliases => { :generator => "-g" }, - :generator => true + g.orm :data_mapper, migration: false + g.plugin aliases: { generator: "-g" }, + generator: true end expected = { - :rails => { :orm => :data_mapper }, - :plugin => { :generator => true }, - :data_mapper => { :migration => false } + rails: { orm: :data_mapper }, + plugin: { generator: true }, + data_mapper: { migration: false } } assert_equal expected, c.generators.options - assert_equal({ :plugin => { :generator => "-g" } }, c.generators.aliases) + assert_equal({ plugin: { generator: "-g" } }, c.generators.aliases) end end test "generators with string and hash for options should generate symbol keys" do with_bare_config do |c| c.generators do |g| - g.orm 'data_mapper', :migration => false + g.orm 'data_mapper', migration: false end expected = { - :rails => { :orm => :data_mapper }, - :data_mapper => { :migration => false } + rails: { orm: :data_mapper }, + data_mapper: { migration: false } } assert_equal expected, c.generators.options -- cgit v1.2.3