重新生成 rspec 文件
如何按需生成 rspec?
问题是我的 rspec 文件已经由“railsgeneratecontroller”命令自动生成。然后我手动删除了这些文件,希望有一个命令可以用来重新生成这些文件。 我该如何重新生成那些已删除的 rspec 文件而不再次触发“rails 生成控制器”?
我尝试了一些博客建议的一些命令:
$ rails generate rspec_controller pages --skip-migration --skip-fixture --skip
Could not find generator rspec_controller.
但它对我不起作用。
任何建议将非常感激!
how can I generate rspec on-demand?
the thing was my rspec files were already automatically generated by the "rails generate controller" command. Then I manually deleted those files in hope that there should be a command which I can use to regenerate those files.
What do I do to regenerate those deleted rspec files without firing "rails generate controller" again?
I have tried some command I was suggested by some blog:
$ rails generate rspec_controller pages --skip-migration --skip-fixture --skip
Could not find generator rspec_controller.
but it didn't work for me.
any advice would be really appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在应用程序的根文件夹中:
它将向您显示使用说明。
In the root folder of your app:
It will show you the usage instructions.
rspec_controller
已被弃用,取而代之的是 Rails 中的标准controller
生成器。现在,您可以将rspec-rails
包含在Gemfile
中,如下所示:然后将加载 此文件,它自定义 Rails
controller
生成器与 这两行。rspec_controller
is deprecated in favour of the standardcontroller
generator in Rails. It works now by you includingrspec-rails
within yourGemfile
like this:This then will load this file, which customizes what tools the Rails
controller
generator uses with these two lines.这是一个坏主意,有两个原因:
This is a bad idea, for two reasons: