我想参加testfirst.org练习,但由于版本问题/我缺乏知识,似乎无法进入起跑线。
一开始你必须运行测试$ rake
我收到了以下错误..
(in /home/arno/learn_ruby)
rake aborted!
Gem::MissingSpecError: Could not find 'rspec' (~> 2) among 94 total
gem(s)
Checked in
'GEM_PATH=/home/arno/.gem/ruby/2.4.0:/home/arno/.rbenv/
versions/2.4.0/lib/ruby/gems/2.4.0', execute `gem env` for more
information
/home/arno/learn_ruby/Rakefile:2:in `<top (required)>'
(See full trace by running task with --trace)
然后我尝试卸载rspec。然后我尝试安装一个小于3的版本。这也没有用。现在我安装了版本2.9和3.2,但同样的错误仍然存在..
然后我进行了捆绑安装和捆绑更新...虽然仍然无法正常工作但有所改变..
这是我运行测试$ rake时的最新错误..
(in /home/arno/learn_ruby)
rake aborted!
NoMethodError: undefined method `last_comment' for #
<Rake::Application:0x00564ff13bf4b0>
/home/arno/learn_ruby/Rakefile:8:in `new'
/home/arno/learn_ruby/Rakefile:8:in `<top (required)>'
(See full trace by running task with --trace)
这是rakefile ..
# This Rakefile has all the right settings to run the tests inside
each lab
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
答案 0 :(得分:0)
经过2天的搜索,我找到了The Odin Project的解决方案。
他们有测试第一 - Rspec 3版..
如果您遇到同样的问题,请转到他们的回购https://github.com/TheOdinProject/learn_ruby。
仔细阅读自述文件,分发该repo,克隆你的repo版本,cd进入它并捆绑安装..
现在一切正常..