因此,当我的计算机运行3.0.0时,我的Rails框架的Gemfile.lock将我的Rspec设置为2.99。当我运行我的rspec测试时,我得到:
/Users/MrChan/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051:in `load': cannot load such file -- /Users/MrChan/Desktop/matt/week_2/db-drill-ar-student-schema-challenge/source/ar-student-schema/db/spec/student_spec.rb (LoadError)
from /Users/MrChan/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051:in `block in load_spec_files'
from /Users/MrChan/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051:in `each'
from /Users/MrChan/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051:in `load_spec_files'
from /Users/MrChan/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:97:in `setup'
from /Users/MrChan/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:85:in `run'
from /Users/MrChan/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:70:in `run'
from /Users/MrChan/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:38:in `invoke'
from /Users/MrChan/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.0/exe/rspec:4:in `<top (required)>'
from /Users/MrChan/.rbenv/versions/2.1.1/bin/rspec:23:in `load'
from /Users/MrChan/.rbenv/versions/2.1.1/bin/rspec:23:in `<main>'
我知道这可能是一个延伸,但有没有人有任何想法?我已经看了一下我的rspec测试,并尝试将be_true更改为be_truthy符合Rspec v 3.0,但我仍然收到错误......
答案 0 :(得分:1)
您的错误似乎不是Rspec版本错误。第一行说“无法加载此类文件(LoadError)” - 表示它正在尝试加载spec文件,但不能。文件路径为/Users/MrChan/Desktop/matt/week_2/db-drill-ar-student-schema-challenge/source/ar-student-schema/db/spec/student_spec.rb
,因此您应该检查:
此错误的常见原因是尝试在项目子目录中运行rspec
。当您运行rspec
时,Rspec会查找spec/
目录。如果你在一个子目录中 - 在这个例子中可能是db
- 那么Rspec可能会看错了。鉴于你似乎正在通过this code工作,我很确定这就是出现错误的地方。