我正在尝试使用带有命令的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
似乎我搞砸了宝石,但我不确定如何解决它。有什么想法吗?
答案 0 :(得分:6)
删除前导斜杠:
bundle exec rspec spec/models/user_spec.rb