简体   繁体   English

尝试运行RSPEC时出错。 为什么?

[英]Error when trying to run RSPEC. Why?

I can't figure out why my RSPEC isn't working. 我不知道为什么我的RSPEC无法正常工作。 I reinstalled RSPEC with sudo gem install rspec and then tried again to install with a specific version number ( sudo gem install rspec -v 2.11.0 ) 我使用sudo gem install rspec重新安装了RSPEC,然后再次尝试使用特定版本号进行安装( sudo gem install rspec -v 2.11.0

I continue to get the following error message and I cannot figure out what it means. 我继续收到以下错误消息,但我不知道这意味着什么。 I believe that I may or may not have version 1 also installed, not sure. 我相信我可能也可能没有安装版本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 require' from /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:in load' from /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:in map' from /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:in run' from /Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspe /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 require'来自/ Users / Castillo / Desktop / document_spec .rb:1:在<top (required)>' from /Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780: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:in load'from /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:in map的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:in /Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:在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:in从/Users/Castillo/.rvm/gems/ruby-1.9运行。 2-P290 /宝石/ rspe c-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' c-core-2.11.1 / lib / rspec / core / runner.rb:69: run' from /Users/Castillo/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8: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块'

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

require File.expand_path('../document.rb', __FILE__)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM