aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-03-12 20:50:36 +0100
committerJosé Valim <jose.valim@gmail.com>2010-03-12 21:33:39 +0100
commitb8f7ba293567d7dcc4a89d4722b26b7ca8552cae (patch)
tree7dd4c2c8d790467734eb622b2da354cbe92c998d /railties
parentfe43bbd8c71fabb4b612808c42461b2ba9655318 (diff)
downloadrails-b8f7ba293567d7dcc4a89d4722b26b7ca8552cae.tar.gz
rails-b8f7ba293567d7dcc4a89d4722b26b7ca8552cae.tar.bz2
rails-b8f7ba293567d7dcc4a89d4722b26b7ca8552cae.zip
Prettify generators description whenever using the default stack [#4143 status:resolved]
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators.rb4
-rw-r--r--railties/test/generators_test.rb18
2 files changed, 20 insertions, 2 deletions
diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb
index 3c902ce0d4..9a51171cf5 100644
--- a/railties/lib/rails/generators.rb
+++ b/railties/lib/rails/generators.rb
@@ -202,6 +202,10 @@ module Rails
rails.delete("app")
print_list("rails", rails)
+ groups.delete("active_record") if options[:rails][:orm] == :active_record
+ groups.delete("test_unit") if options[:rails][:test_framework] == :test_unit
+ groups.delete("erb") if options[:rails][:template_engine] == :erb
+
groups.sort.each { |b, n| print_list(b, n) }
end
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb
index dd17f8f756..2975e3e3ef 100644
--- a/railties/test/generators_test.rb
+++ b/railties/test/generators_test.rb
@@ -104,11 +104,25 @@ class GeneratorsTest < Rails::Generators::TestCase
def test_rails_generators_with_others_information
output = capture(:stdout){ Rails::Generators.help }
- assert_match /ActiveRecord:/, output
assert_match /Fixjour:/, output
+ assert_match /^ fixjour$/, output
+ end
+
+ def test_rails_generators_does_not_show_activerecord_info_if_its_the_default
+ output = capture(:stdout){ Rails::Generators.help }
+ assert_no_match /ActiveRecord:/, output
+ assert_no_match /^ active_record:model$/, output
+ assert_no_match /^ active_record:fixjour$/, output
+ end
+
+ def test_rails_generators_shows_activerecord_info_if_its_not_the_default
+ Rails::Generators.options[:rails][:orm] = :data_mapper
+ output = capture(:stdout){ Rails::Generators.help }
+ assert_match /ActiveRecord:/, output
assert_match /^ active_record:model$/, output
assert_match /^ active_record:fixjour$/, output
- assert_match /^ fixjour$/, output
+ ensure
+ Rails::Generators.options[:rails][:orm] = :active_record
end
def test_no_color_sets_proper_shell