本文介绍了试图使用rspec,但得到一个错误,rspec-core 2.2.1已被激活,但我的Gemfile需要rspec-core 2.1.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我更新了我的宝石。我已经创建了一个示例Rails应用程序,并在我的Gemfile中有以下内容:
I've update my gems. I've created a sample Rails app and have the following in my Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'sqlite3-ruby', :require => 'sqlite3'
group :development do
gem 'rspec-rails'
end
group :test do
gem 'rspec'
gem 'webrat', '0.7.1'
end
然而,当我运行'rspec spec /'时,我收到以下消息:
However, when I run 'rspec spec/', I get the following message:
/home/jeff/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.7/lib/bundler/runtime.rb:27:in `block in setup':
You have already activated rspec-core 2.2.1, but your Gemfile requires rspec-core 2.1.0.
Consider using bundle exec. (Gem::LoadError)
推荐答案
$ c> bundle update rspec 和 bundle update rspec-rails
。您的根目录下的 Gemfile.lock
文件可能会为每个宝石指定一个版本号。
try using bundle update rspec
and bundle update rspec-rails
. your Gemfile.lock
file, located in the root directory, is probably specifying a version number for each gem.
这篇关于试图使用rspec,但得到一个错误,rspec-core 2.2.1已被激活,但我的Gemfile需要rspec-core 2.1.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!