找不到生成器 rspec_model 问题
我正在尝试为我的模型用户创建一个 rspec,但每次运行时:
rails g rspec_model User
我都找不到生成器 rspec_model。
我检查了另一个 stackoverflow 线程,它说确保我有 gem 'rspec-rails',我确实有。我做错了什么?这是我的宝石文件:
group :test do
# Pretty printed test output
gem 'turn', :require => false
gem 'rspec', '2.0.1'
gem 'webrat', '0.7.1'
end
group :development do
gem 'rspec-rails', '2.0.1'
gem 'sqlite3'
end
I am trying to create an rspec for my model User but every time I run:
rails g rspec_model User
I get Could not find generator rspec_model.
I checked another stackoverflow thread and it said make sure I have the gem 'rspec-rails' and I do. What am I doing wrong? Here's my gemfile:
group :test do
# Pretty printed test output
gem 'turn', :require => false
gem 'rspec', '2.0.1'
gem 'webrat', '0.7.1'
end
group :development do
gem 'rspec-rails', '2.0.1'
gem 'sqlite3'
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请使用(一次):
它将创建各种文件和spec目录。
例如,您随后需要创建模型目录并开始在该目录中创建规格。
一旦您为 rspec 配置应用程序, script/rails generated ModelName 还将创建我相信的 rspec 骨架文件。
Please use (once):
It will create the various files and the spec directory.
You will then need to, for example, create the models directory and start creating specs in that directory.
Once you configure your application for rspec, script/rails generate ModelName will also create the rspec skeleton files I believe.
https://github.com/rspec/rspec-rails/tree/4c8cdaef2c6f3dda29d45b7900f0b00335eeec84/lib/generators/rspec/model
https://github.com/rspec/rspec-rails/tree/4c8cdaef2c6f3dda29d45b7900f0b00335eeec84/lib/generators/rspec/model