Rails 4 remove test generators (especially test_unit)

∥☆過路亽.° 提交于 2019-12-04 19:58:10

问题


How I can remove test_unit generators to make them disappear from the rails generate list?

I have already tried some ways that did not work for me:

config.generators do |g|
  g.test_framework nil
end

create app with -T option.

My rails g output:

[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

回答1:


In your config/application.rb where you have the generations settings, you can hide some of the generators you don't want to see. For example:

config.generators do |g|
  g.hidden_namespaces << :test_unit << :erb
  g.test_framework :mini_test
  g.template_engine :slim
  # ...
end


来源:https://stackoverflow.com/questions/15297981/rails-4-remove-test-generators-especially-test-unit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!