diff options
author | Prem Sichanugrist <s@sikac.hu> | 2013-02-24 13:46:27 -0500 |
---|---|---|
committer | Prem Sichanugrist <s@sikac.hu> | 2013-02-24 14:31:08 -0500 |
commit | 2da5ea1c9feb4a7b491bd00bd6ffd931b9203da8 (patch) | |
tree | eb549cf5d0ade20f86dca4e1765a8516a81298eb /railties/test/generators | |
parent | 5fc3b87c93edf770ea0d6b52a28ea225183dbfd7 (diff) | |
download | rails-2da5ea1c9feb4a7b491bd00bd6ffd931b9203da8.tar.gz rails-2da5ea1c9feb4a7b491bd00bd6ffd931b9203da8.tar.bz2 rails-2da5ea1c9feb4a7b491bd00bd6ffd931b9203da8.zip |
Remove `--builder` option from `rails` command
Ability to use a custom builder by passing `--builder` (or `-b`) has
been removed. Consider using application template instead. See this
guide for more detail:
http://guides.rubyonrails.org/rails_application_templates.html
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 25 | ||||
-rw-r--r-- | railties/test/generators/plugin_new_generator_test.rb | 35 | ||||
-rw-r--r-- | railties/test/generators/shared_generator_tests.rb | 58 |
3 files changed, 0 insertions, 118 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 83f43d1025..19ed7de7c9 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -366,28 +366,3 @@ protected assert_file "Gemfile", /^gem\s+["']#{gem}["']$/ end end - -class CustomAppGeneratorTest < Rails::Generators::TestCase - include GeneratorsTestHelper - tests Rails::Generators::AppGenerator - - arguments [destination_root] - include SharedCustomGeneratorTests - -protected - def default_files - ::DEFAULT_APP_FILES - end - - def builders_dir - "app_builders" - end - - def builder_class - :AppBuilder - end - - def action(*args, &block) - silence(:stdout) { generator.send(*args, &block) } - end -end diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb index 4bf5a2f08b..904c1db57e 100644 --- a/railties/test/generators/plugin_new_generator_test.rb +++ b/railties/test/generators/plugin_new_generator_test.rb @@ -371,38 +371,3 @@ protected ::DEFAULT_PLUGIN_FILES end end - -class CustomPluginGeneratorTest < Rails::Generators::TestCase - include GeneratorsTestHelper - tests Rails::Generators::PluginNewGenerator - - destination File.join(Rails.root, "tmp/bukkits") - arguments [destination_root] - include SharedCustomGeneratorTests - - def test_overriding_test_framework - FileUtils.cd(destination_root) - run_generator([destination_root, "-b", "#{Rails.root}/lib/plugin_builders/spec_builder.rb"]) - assert_file 'spec/spec_helper.rb' - assert_file 'spec/dummy' - assert_file 'Rakefile', /task default: :spec/ - assert_file 'Rakefile', /# spec tasks in rakefile/ - end - -protected - def default_files - ::DEFAULT_PLUGIN_FILES - end - - def builder_class - :PluginBuilder - end - - def builders_dir - "plugin_builders" - end - - def action(*args, &block) - silence(:stdout){ generator.send(*args, &block) } - end -end diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb index 2081f4aba8..2724882a23 100644 --- a/railties/test/generators/shared_generator_tests.rb +++ b/railties/test/generators/shared_generator_tests.rb @@ -140,61 +140,3 @@ module SharedGeneratorTests assert_no_file('app/mailers/.keep') end end - -module SharedCustomGeneratorTests - def setup - Rails.application = TestApp::Application - super - Rails::Generators::AppGenerator.instance_variable_set('@desc', nil) - end - - def teardown - super - Rails::Generators::AppGenerator.instance_variable_set('@desc', nil) - Object.class_eval do - remove_const :AppBuilder if const_defined?(:AppBuilder) - remove_const :PluginBuilder if const_defined?(:PluginBuilder) - end - Rails.application = TestApp::Application.instance - end - - def test_builder_option_with_empty_app_builder - FileUtils.cd(destination_root) - run_generator([destination_root, "-b", "#{Rails.root}/lib/#{builders_dir}/empty_builder.rb"]) - default_files.each{ |path| assert_no_file path } - end - - def test_builder_option_with_simple_plugin_builder - FileUtils.cd(destination_root) - run_generator([destination_root, "-b", "#{Rails.root}/lib/#{builders_dir}/simple_builder.rb"]) - (default_files - ['.gitignore']).each{ |path| assert_no_file path } - assert_file ".gitignore", "foobar" - end - - def test_builder_option_with_relative_path - here = File.expand_path(File.dirname(__FILE__)) - FileUtils.cd(here) - run_generator([destination_root, "-b", "../fixtures/lib/#{builders_dir}/simple_builder.rb"]) - FileUtils.cd(destination_root) - (default_files - ['.gitignore']).each{ |path| assert_no_file path } - assert_file ".gitignore", "foobar" - end - - def test_builder_option_with_tweak_plugin_builder - FileUtils.cd(destination_root) - run_generator([destination_root, "-b", "#{Rails.root}/lib/#{builders_dir}/tweak_builder.rb"]) - default_files.each{ |path| assert_file path } - assert_file ".gitignore", "foobar" - end - - def test_builder_option_with_http - url = "https://gist.github.com/josevalim/103208/raw/" - template = "class #{builder_class}; end" - template.instance_eval "def read; self; end" # Make the string respond to read - - generator([destination_root], builder: url).expects(:open).with(url, 'Accept' => 'application/x-thor-template').returns(template) - quietly { generator.invoke_all } - - default_files.each{ |path| assert_no_file(path) } - end -end |