提交 b8f7ba29 编写于 作者: J José Valim

Prettify generators description whenever using the default stack [#4143 status:resolved]

上级 fe43bbd8
......@@ -202,6 +202,10 @@ def self.help(command = 'generate')
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
......
......@@ -104,11 +104,25 @@ def test_rails_generators_help_with_builtin_information
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册