找不到生成器 rspec:install (q2) [英] Could not find generator rspec:install (q2)
问题描述
我正在尝试在这里学习本教程:http://railstutorial.org/chapters/static-pages#top
I'm trying to follow this tutorial here: http://railstutorial.org/chapters/static-pages#top
当我跑步时:
$ rails 生成 rspec:install
$ rails generate rspec:install
我明白了:
找不到生成器 rspec:install.
可能是什么问题?
[轨道 3、4、5、6、7]
[Rails 3, 4, 5, 6, 7]
谢谢.
推荐答案
添加到您的 Gemfile:
Add to your Gemfile:
group :development, :test do
gem 'rspec-rails'
end
并运行捆绑安装
确保它位于:development 和:test 块.如果你不小心把它只放在:test块中,它会给出上面的错误(那是因为默认情况下你在development
环境中运行并且rspec ins't可用于该环境).
make sure that it is in both the :development and :test blocks. If you inadvertently put it only in the :test block, it will give the error above (that's because by default you're running in the development
environment and rspec ins't available to that environment).
rails generate rspec:install
然后应该按预期运行.
rails generate rspec:install
should then run as expected.
这篇关于找不到生成器 rspec:install (q2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!