Rails 4删除测试生成器(尤其是test_unit)

fre*_*oid 8 ruby-on-rails generator ruby-on-rails-3 ruby-on-rails-3.2

如何删除test_unit生成器以使它们从rails generate列表中消失?

我已经尝试过一些对我不起作用的方法:

config.generators do |g|
  g.test_framework nil
end
Run Code Online (Sandbox Code Playgroud)

使用-T选项创建应用.

我的rails g输出:

[a lot of other generators skipped]

    TestUnit:
      test_unit:controller
      test_unit:helper
      test_unit:integration
      test_unit:mailer
      test_unit:model
      test_unit:plugin
      test_unit:scaffold
Run Code Online (Sandbox Code Playgroud)

Evg*_*eny 10

在您config/application.rb拥有世代设置的地方,您可以隐藏一些您不想看到的生成器.例如:

config.generators do |g|
  g.hidden_namespaces << :test_unit << :erb
  g.test_framework :mini_test
  g.template_engine :slim
  # ...
end
Run Code Online (Sandbox Code Playgroud)