2017-06-14 78 views
0

我想做testfirst.org練習,儘管由於版本問題/缺乏知識,我似乎無法到達起跑線。 。Testfirst.org - 瞭解ruby課程 - Rspec問題無法解決

在開始時,你必須運行測試$耙

我得到了下面的錯誤..

(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安裝,但同樣的錯誤依然存在..

我當時也捆綁安裝和捆綁更新......事情發生了轉變,儘管仍然沒有工作..

下面是最新的錯誤當我運行測試$耙..

(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) 

這裏是Rake文件..

# 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

搜索後2天,我發現,奧丁項目解決方案。

他們有一個測試先行 - Rspec的3版..

如果有同樣的問題去他們回購https://github.com/TheOdinProject/learn_ruby

通過自述文件,叉即回購,克隆你的回購的版本,cd到它,並捆綁安裝閱讀..

所有工作正常,現在..