2013-08-21 39 views
0

我正在使用rails 4.0。在rails 4.0中,无法运行“rails generate rspec <users>”命令

我尝试使用以下命令

$ rails generate rspec static_pages 

创建一个rspec的文件,但该命令没有工作,它显示以下错误

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. 

回答

2

你可以通过安装发电机的列表键入“rails generate”

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

rails generate rspec:model user 

如这里https://www.relishapp.com/rspec/rspec-rails/docs/generators这里https://github.com/rspec/rspec-rails

+0

说明如何创建静态页面rspec的? –

+0

我不知道这里有一个生成器,但是您可以从一个视图规范开始,然后复制到spec文件夹或子文件夹中的新文件,然后修改它以测试您的静态页面。 – nachbar

+0

如果我尝试使用“$ rails generate bootstrap:install”安装引导程序插件,我将得到以下错误, 找不到生成器引导程序:install –

相关问题