【问题标题】:Rails 4 remove test generators (especially test_unit)Rails 4 移除测试生成器(尤其是 test_unit)
【发布时间】:2013-02-24 05:35:11
【问题描述】:

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

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

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

使用-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

【问题讨论】:

  • 你能发布你的生成器输出吗?
  • 已更新。没什么特别的,只是默认的 test_unit 生成器。

标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2 generator


【解决方案1】:

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

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

【讨论】:

  • 我不得不这样做g.hidden_namespaces &lt;&lt; 'test_unit' &lt;&lt; 'erb',但它就像一个魅力!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-03-27
  • 2021-09-14
  • 2016-11-07
  • 2014-08-30
  • 1970-01-01
  • 2012-05-13
  • 1970-01-01
相关资源
最近更新 更多