如何关闭 Rails 3 中 RSpec 2 的生成器?
我在 Rails 3 RC 下安装了当前的 RSpec 2 Beta,如 GitHub 页面(和几个博客)中所述。一切正常,但我无法像某些博客上建议的那样关闭特定的生成器。
这是我在 ./config/application.rb 中所做的:
config.generators do |g|
g.test_framework :rspec, :fixtures => false, :views => false
end
但是当执行“rails gscaffold Model name:string”时,这些视图规范仍然会生成。 我的设置有什么问题吗?
I installed the current RSpec 2 Beta under Rails 3 RC as mentioned on the GitHub page (and several blogs). Everything works fine, but I am not able to turn off specific generators like advised on some blogs.
Here is what I do in ./config/application.rb:
config.generators do |g|
g.test_framework :rspec, :fixtures => false, :views => false
end
But when doing a "rails g scaffold Model name:string" those view specs are still generated.
What's wrong with my setup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要传递
:view_specs =>; false
选项也是如此。我不知道为什么控制器生成器(其中:views => false
有效)和脚手架之间存在不同。我去问大卫。You'll want to pass the
:view_specs => false
option too. I don't know why this is different between the controller generator (where:views => false
has effect) and scaffold. I'll ask David.您无法停止模型规范的生成,这是必要的,如果您希望进入 rspec 生成器 model/model_generator.rb 的源代码,您会发现没有 class_option :model_spec ....
下面给出了允许的选项,除了 webrat也可以添加或
You can not stop generation of model spec, that is necessary and if you hope into the source code for rspec generator model/model_generator.rb you'll find there is no class_option :model_spec ....
Options allowd are give below, except webrat that can also be added or