Ruby - 没有这样的文件加载ERROR RUBY

时间:2015-05-01 19:56:47

标签: ruby-on-rails ruby macos rspec

我试图使用rspec来运行spec文件。但是,当我运行命令(bundle exec rspec spec / 00_hello_spec.rb)时,我收到错误说:

/Library/Ruby/Gems/1.8/gems/rspec-core-2.99.1/lib/rspec/core/configuration.rb:1065:in `load': no such file to load -- /Users/Home/Desktop/test-first-ruby-master/spec/spec/00_hello_spec.rb (LoadError)
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.99.1/lib/rspec/core/configuration.rb:1065:in `load_spec_files'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.99.1/lib/rspec/core/configuration.rb:1065:in `each'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.99.1/lib/rspec/core/configuration.rb:1065:in `load_spec_files'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.99.1/lib/rspec/core/command_line.rb:18:in `run'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.99.1/lib/rspec/core/runner.rb:103:in `run'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.99.1/lib/rspec/core/runner.rb:17:in `autorun'
from /usr/bin/rspec:23

我尝试按照其他一些SO答案的说明进行操作,例如包括require' ruby​​gems.rb'在spec文件的顶部并尝试require_relative,但它不行。我使用的是Mac OSX 10.6.8,Ruby 1.8.7和RubyGems 2.4.6。

我的Ruby详细信息:

    Homes-MacBook:~ Home$ which -a ruby
    /usr/bin/ruby
    Homes-MacBook:~ Home$ gem environment
    RubyGems Environment:
    - RUBYGEMS VERSION: 2.4.6
    - RUBY VERSION: 1.8.7 (2012-02-08 patchlevel 358) [universal-       
    darwin10.0]
    - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
    - RUBY EXECUTABLE:     
  /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
    - EXECUTABLE DIRECTORY: /usr/bin
    - SPEC CACHE DIRECTORY: /Users/Home/.gem/specs
    - SYSTEM CONFIGURATION DIRECTORY:   
  /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/etc
    - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-10
    - GEM PATHS:
    - /Library/Ruby/Gems/1.8
    - /Users/Home/.gem/ruby/1.8
     /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
   - GEM CONFIGURATION:
   - :update_sources => true
   - :verbose => true
   - :backtrace => false
   - :bulk_threshold => 1000
   - REMOTE SOURCES:
   - https://rubygems.org/
   - SHELL PATH:
   - /usr/bin
   - /bin
   - /usr/sbin
   - /sbin
   - /usr/local/bin
   - /usr/X11/bin
   - /Users/Home/.rvm/bin
   Homes-MacBook:~ Home$ which gem
   /usr/bin/gem

0 个答案:

没有答案