【问题标题】:In rails 4.0, not able to run "rails generate rspec <users>" command在 rails 4.0 中,无法运行“rails generate rspec <users>”命令
【发布时间】:2013-08-21 06:53:38
【问题描述】:

我正在使用 Rails 4.0。

我正在尝试使用以下命令创建一个 rspec 文件

$ rails generate rspec static_pages

但是这个命令不起作用,它显示下面的错误

DEPRECATION WARNING: config.whiny_nils option is deprecated and no longer works. (called   from block in <top (required)> at   /home/shruthi/Projects/samples/tutorials/config/environments/development.rb:10)
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:

* development - set it to false
* test - set it to false (unless you use a tool that preloads your test environment)
* production - set it to true

Could not find generator rspec.

【问题讨论】:

    标签: ruby-on-rails rspec generator


    【解决方案1】:

    您可以通过键入“rails generate”来获取已安装生成器的列表

    要为用户模型生成规范文件,请尝试:

    rails generate rspec:model user
    

    这里提到https://www.relishapp.com/rspec/rspec-rails/docs/generators 和这里https://github.com/rspec/rspec-rails

    【讨论】:

    • 如何为静态页面创建rspec?
    • 我不知道是否有生成器,但您可以从视图规范开始并复制到规范文件夹或子文件夹中的新文件,然后对其进行修改以测试您的静态页面。
    • 如果我尝试使用“$ rails generate bootstrap:install”安装引导插件,我会得到以下错误,找不到生成器引导:安装
    • 你安装了 'twitter-bootstrap-rails' gem 吗?请参阅 github.com/seyhunak/twitter-bootstrap-rails 和 Bootstrap 上的 Railscast railscasts.com/episodes/328-twitter-bootstrap-basics
    • 是的。安装 'twitter-bootstrap-rails' gem 后,它工作正常。谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-15
    • 1970-01-01
    相关资源
    最近更新 更多