我正在尝试按照基本的rails教程,但在需要gem 'shoulda-matchers'
的时候遇到麻烦。我将它包含在我的gem文件中:
group :test do
gem 'capybara', '~>2.1.0'
gem 'shoulda-matchers', '~>2.6.1'
end
并且似乎已成功运行bundle来安装它:
Using shoulda-matchers 2.6.1
Using spring 1.1.3
Using sqlite3 1.3.9
Using turbolinks 2.2.2
Using uglifier 2.5.0
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
但是,当我尝试下一步创建模型时:
bin/rails generate model todo_item todo_list:references content:string
我收到以下错误消息:
Could not find shoulda-matchers-2.6.1 in any of the sources
Run `bundle install` to install missing gems.
我跑了bundle show shoulda-matchers
并回来/Users/biversens/.rvm/gems/ruby-2.1.2/gems/shoulda-matchers-2.6.1
我尝试使用bundle手动安装gem,并使用bundle install但似乎没有任何工作。这可能是由于教程运行旧版本的宝石?
答案 0 :(得分:4)
如果没有rspec,只需在Gemfile中包含gem' Shoulda'