0

我不知道为什么我的 RSPEC 不起作用。我使用 sudo gem install rspec 重新安装了 RSPEC,然后再次尝试使用特定版本号 ( sudo gem install rspec -v 2.11.0)

我继续收到以下错误消息,但我无法弄清楚它的含义。我相信我可能也安装了版本 1,也可能没有安装,不确定。

Castillo$ rspec document_spec.rb 

/Users/Castillo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': no such file to load -- document (LoadError) from /Users/Castillo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in 来自/Users/Castillo/Desktop/document_spec.rb :1:in <top (required)>' from /Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:inload' 来自 /Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in block in load_spec_files' from /Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:inmap'来自 /Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in load_spec_files' from /Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:inrun' 来自 /Users/Castillo/ .rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in run' from /Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in block in autorun'

4

1 回答 1

4

将文件的完整路径添加document.rb到规范文件中或使用 require_relative

require File.expand_path('../document.rb', __FILE__)
于 2012-07-27T19:37:54.300 回答