diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-11-08 22:43:51 +0100 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-11-08 22:43:51 +0100 |
commit | cc135e3b6df1785852de2470b4b93559c88c891e (patch) | |
tree | 7e619408668ec50d437cfb6c76182bdc9df44734 /railties | |
parent | 1fd46240a61efa72c2e1259fbeafae5cfd8a6df9 (diff) | |
download | rails-cc135e3b6df1785852de2470b4b93559c88c891e.tar.gz rails-cc135e3b6df1785852de2470b4b93559c88c891e.tar.bz2 rails-cc135e3b6df1785852de2470b4b93559c88c891e.zip |
Allow to set dummy application path through options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb | 5 | ||||
-rw-r--r-- | railties/test/generators/plugin_new_generator_test.rb | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb index d4706063f3..8fac6fc70a 100644 --- a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +++ b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb @@ -102,6 +102,9 @@ task :default => :test alias_method :plugin_path, :app_path + class_option :dummy_path, :type => :string, :default => "test/dummy", + :desc => "Create dummy application at given path" + class_option :full, :type => :boolean, :default => false, :desc => "Generate rails engine with integration tests" @@ -232,7 +235,7 @@ end def dummy_path(path = nil) @dummy_path = path if path - @dummy_path || "test/dummy" + @dummy_path || options[:dummy_path] end def mute(&block) diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb index a59013b061..8dc5ca90ba 100644 --- a/railties/test/generators/plugin_new_generator_test.rb +++ b/railties/test/generators/plugin_new_generator_test.rb @@ -140,6 +140,13 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase assert_file "app/helpers/bukkits/application_helper.rb", /module Bukkits\n module ApplicationHelper/ end + def test_passing_dummy_path_as_a_parameter + run_generator [destination_root, "--dummy_path", "spec/dummy"] + assert_file "spec/dummy" + assert_file "spec/dummy/config/application.rb" + assert_no_file "test/dummy" + end + protected def action(*args, &block) |