diff options
Diffstat (limited to 'railties/test')
19 files changed, 27 insertions, 23 deletions
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index 199b5fa8b4..f5cb26cf52 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -182,7 +182,7 @@ class ActionsTest < GeneratorsTestCase end def generator(config={}) - @generator ||= Rails::Generators::Base.new([], {}, { :destination_root => destination_root }.merge!(config)) + @generator ||= Rails::Generators::Base.new([], {}, config) end def action(*args, &block) diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 20f2a24e6d..c44d25b72c 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -126,7 +126,7 @@ class AppGeneratorTest < GeneratorsTestCase def test_template_from_dir_pwd FileUtils.cd(Rails.root) - assert_match /It works from file!/, run_generator(["-m", "lib/template.rb"]) + assert_match /It works from file!/, run_generator(["-m", "../lib/template.rb"]) end def test_template_raises_an_error_with_invalid_path @@ -170,7 +170,7 @@ class AppGeneratorTest < GeneratorsTestCase end def generator(options={}) - @generator ||= Rails::Generators::AppGenerator.new([destination_root], options, :destination_root => destination_root) + @generator ||= Rails::Generators::AppGenerator.new([destination_root], options) end def action(*args, &block) diff --git a/railties/test/generators/controller_generator_test.rb b/railties/test/generators/controller_generator_test.rb index 56bc688ad0..3020e928dc 100644 --- a/railties/test/generators/controller_generator_test.rb +++ b/railties/test/generators/controller_generator_test.rb @@ -74,7 +74,7 @@ class ControllerGeneratorTest < GeneratorsTestCase protected def run_generator(args=["Account", "foo", "bar"]) - silence(:stdout) { Rails::Generators::ControllerGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::ControllerGenerator.start args } end end diff --git a/railties/test/generators/generator_generator_test.rb b/railties/test/generators/generator_generator_test.rb index aea3f4da51..703aa20914 100644 --- a/railties/test/generators/generator_generator_test.rb +++ b/railties/test/generators/generator_generator_test.rb @@ -20,7 +20,7 @@ class GeneratorGeneratorTest < GeneratorsTestCase protected def run_generator(args=["awesome"], config={}) - silence(:stdout) { Rails::Generators::GeneratorGenerator.start args, config.merge(:destination_root => destination_root) } + silence(:stdout) { Rails::Generators::GeneratorGenerator.start args, config } end end diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index ccf08c347c..829a38c103 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -1,5 +1,5 @@ # TODO: Fix this RAILS_ENV stuff -RAILS_ENV = 'test' +RAILS_ENV = 'test' unless defined?(RAILS_ENV) require 'abstract_unit' Rails.application.config.root = File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures')) @@ -11,12 +11,17 @@ require 'action_dispatch' CURRENT_PATH = File.expand_path(Dir.pwd) Rails::Generators.no_color! +module Rails + def self.root + @root ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures', 'tmp')) + end +end + class GeneratorsTestCase < Test::Unit::TestCase include FileUtils def destination_root - @destination_root ||= File.expand_path(File.join(File.dirname(__FILE__), - '..', 'fixtures', 'tmp')) + Rails.root end def setup diff --git a/railties/test/generators/helper_generator_test.rb b/railties/test/generators/helper_generator_test.rb index f8bfc517a2..44f5a324af 100644 --- a/railties/test/generators/helper_generator_test.rb +++ b/railties/test/generators/helper_generator_test.rb @@ -54,7 +54,7 @@ class HelperGeneratorTest < GeneratorsTestCase protected def run_generator(args=["admin"]) - silence(:stdout) { Rails::Generators::HelperGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::HelperGenerator.start args } end end diff --git a/railties/test/generators/integration_test_generator_test.rb b/railties/test/generators/integration_test_generator_test.rb index 6a504ceea2..68b55a66f9 100644 --- a/railties/test/generators/integration_test_generator_test.rb +++ b/railties/test/generators/integration_test_generator_test.rb @@ -12,7 +12,7 @@ class IntegrationTestGeneratorTest < GeneratorsTestCase protected def run_generator(args=["integration"]) - silence(:stdout) { Rails::Generators::IntegrationTestGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::IntegrationTestGenerator.start args } end end diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb index 251474ad16..e33af25773 100644 --- a/railties/test/generators/mailer_generator_test.rb +++ b/railties/test/generators/mailer_generator_test.rb @@ -46,7 +46,7 @@ class MailerGeneratorTest < GeneratorsTestCase protected def run_generator(args=["notifier", "foo", "bar"]) - silence(:stdout) { Rails::Generators::MailerGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::MailerGenerator.start args } end end diff --git a/railties/test/generators/metal_generator_test.rb b/railties/test/generators/metal_generator_test.rb index 80bf342892..4f36e0f612 100644 --- a/railties/test/generators/metal_generator_test.rb +++ b/railties/test/generators/metal_generator_test.rb @@ -17,7 +17,7 @@ class MetalGeneratorTest < GeneratorsTestCase protected def run_generator(args=["foo"]) - silence(:stdout) { Rails::Generators::MetalGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::MetalGenerator.start args } end end diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index 35172a8be4..b1fdbef425 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -53,7 +53,7 @@ class MigrationGeneratorTest < GeneratorsTestCase protected def run_generator(args=[@migration]) - silence(:stdout) { Rails::Generators::MigrationGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::MigrationGenerator.start args } end end diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index e073b11e1e..a0d4bed992 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -175,7 +175,7 @@ class ModelGeneratorTest < GeneratorsTestCase protected def run_generator(args=["Account", "name:string", "age:integer"], config={}) - silence(:stdout) { Rails::Generators::ModelGenerator.start args, config.merge(:destination_root => destination_root) } + silence(:stdout) { Rails::Generators::ModelGenerator.start args, config } end end diff --git a/railties/test/generators/observer_generator_test.rb b/railties/test/generators/observer_generator_test.rb index 6fed2998dd..becc217ac0 100644 --- a/railties/test/generators/observer_generator_test.rb +++ b/railties/test/generators/observer_generator_test.rb @@ -27,7 +27,7 @@ class ObserverGeneratorTest < GeneratorsTestCase protected def run_generator(args=["account"]) - silence(:stdout) { Rails::Generators::ObserverGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::ObserverGenerator.start args } end end diff --git a/railties/test/generators/performance_test_generator_test.rb b/railties/test/generators/performance_test_generator_test.rb index d19128f79a..00906a61e0 100644 --- a/railties/test/generators/performance_test_generator_test.rb +++ b/railties/test/generators/performance_test_generator_test.rb @@ -12,7 +12,7 @@ class PerformanceTestGeneratorTest < GeneratorsTestCase protected def run_generator(args=["performance"]) - silence(:stdout) { Rails::Generators::PerformanceTestGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::PerformanceTestGenerator.start args } end end diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index f5b8b6ffb6..c8bfaf3d97 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -50,7 +50,7 @@ class PluginGeneratorTest < GeneratorsTestCase protected def run_generator(args=["plugin_fu"], config={}) - silence(:stdout) { Rails::Generators::PluginGenerator.start args, config.merge(:destination_root => destination_root) } + silence(:stdout){ Rails::Generators::PluginGenerator.start args, config } end end diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb index dcae81c204..99811bc07b 100644 --- a/railties/test/generators/resource_generator_test.rb +++ b/railties/test/generators/resource_generator_test.rb @@ -100,7 +100,7 @@ class ResourceGeneratorTest < GeneratorsTestCase protected def run_generator(args=["account"], config={}) - silence(:stdout) { Rails::Generators::ResourceGenerator.start args, config.merge(:destination_root => destination_root) } + silence(:stdout) { Rails::Generators::ResourceGenerator.start args, config } end end diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index 02155c295c..43647360d6 100644 --- a/railties/test/generators/scaffold_controller_generator_test.rb +++ b/railties/test/generators/scaffold_controller_generator_test.rb @@ -139,7 +139,7 @@ class ScaffoldControllerGeneratorTest < GeneratorsTestCase protected def run_generator(args=["User", "name:string", "age:integer"]) - silence(:stdout) { Rails::Generators::ScaffoldControllerGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::ScaffoldControllerGenerator.start args } end end diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index c0652c034f..09ab58e404 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -122,8 +122,7 @@ class ScaffoldGeneratorTest < GeneratorsTestCase def run_generator(config={}) silence(:stdout) do - Rails::Generators::ScaffoldGenerator.start ["product_line", "title:string", "price:integer"], - config.merge(:destination_root => destination_root) + Rails::Generators::ScaffoldGenerator.start ["product_line", "title:string", "price:integer"], config end end diff --git a/railties/test/generators/session_migration_generator_test.rb b/railties/test/generators/session_migration_generator_test.rb index 34fb996b7f..342b9a900e 100644 --- a/railties/test/generators/session_migration_generator_test.rb +++ b/railties/test/generators/session_migration_generator_test.rb @@ -28,7 +28,7 @@ class SessionMigrationGeneratorTest < GeneratorsTestCase protected def run_generator(args=[]) - silence(:stdout) { Rails::Generators::SessionMigrationGenerator.start args, :destination_root => destination_root } + silence(:stdout) { Rails::Generators::SessionMigrationGenerator.start args } end end diff --git a/railties/test/generators/stylesheets_generator_test.rb b/railties/test/generators/stylesheets_generator_test.rb index 15263d4bb8..6a07898c51 100644 --- a/railties/test/generators/stylesheets_generator_test.rb +++ b/railties/test/generators/stylesheets_generator_test.rb @@ -18,7 +18,7 @@ class StylesheetsGeneratorTest < GeneratorsTestCase protected def run_generator(config={}) - silence(:stdout) { Rails::Generators::StylesheetsGenerator.start [], config.merge(:destination_root => destination_root) } + silence(:stdout) { Rails::Generators::StylesheetsGenerator.start [], config } end end |