Reputation: 69
I'm trying to do the labs on TestFirst.org with rspec. I've installed rspec and initilized it in the project directory. But when i "rake" i get this error message:
Could not find 'rspec' <~> 2) - did find: [rspec-3.0.0]
C:/Sites/RubyTest/RubyTesting/learn_ruby/rakefile:2:in `<top (required)>´
My versions:
ruby 1.9.3p545
rails 4.1.1
rspec 3.0.2
Seems like I've got the wrong version of rspec or something. My OS is windows 7 btw.
This is the content of rakefile:
gem 'rspec', '~>2'
require 'rspec/core/rake_task'
task :default => :spec
desc "run tests for this lab"
RSpec::Core::RakeTask.new do |task|
lab = Rake.application.original_dir
task.pattern = "#{lab}/*_spec.rb"
task.rspec_opts = [ "-I#{lab}", "-I#{lab}/solution", '-f documentation', '-r ./rspec_config']
task.verbose = false
end
Upvotes: 0
Views: 82
Reputation: 29094
This is because rspec ~3.0.0
is already activated and your rake file requires 'rspec', '~>2'
. Change rspec version in Rakefile to fix this.
gem 'rspec', '~>3'
Upvotes: 1
Reputation: 7714
Looks like you have a installed version of rspec (3.0.2) that is more recent than the one expected by the project (~ 2.x).
One simple way to solve it would be to force bundle to use the project version:
bundle exec rake
(instead of just using rake)
Upvotes: 0