2

我正在尝试使用带有命令的 rspec 运行测试套件

bundle exec rspec /spec/models/user_spec.rb

或者

bundle exec rspec /spec/requests

导致以下错误消息:

/Users/ms/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load': cannot load such file -- /spec/requests (LoadError)
from /Users/ms/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
from /Users/ms/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
from /Users/ms/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
from /Users/ms/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/ms/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
from /Users/ms/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'

即使我恢复到默认测试文件,我也会收到此错误,例如:

require 'spec_helper'
describe User do
  pending "add some examples to (or delete) #{__FILE__}"
end

好像我搞砸了宝石,但我不确定如何修复它。有任何想法吗?

4

1 回答 1

6

删除前导正斜杠:

bundle exec rspec spec/models/user_spec.rb
于 2012-11-12T06:51:33.530 回答