运行rake时rspec错误

时间:2013-09-28 22:05:37

标签: ruby rspec rake

我是一个菜鸟,正在学习许多人可能知道的教程(testfirst.org)。当我尝试运行'rake'时,我在terminal.app中收到以下错误:

    fname-lnames-macbook-pro:00_hello macbookowner$ rake
    (in /Users/macbookowner/Desktop/learn_ruby-master)
    /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:216: warning: Insecure world writable dir /Users in PATH, mode 040777
    /Users/macbookowner/Desktop/learn_ruby-master/00_hello/hello_spec.rb:116:in `require': cannot load such file -- hello (LoadError)
        from /Users/macbookowner/Desktop/learn_ruby-master/00_hello/hello_spec.rb:116:in `<top (required)>'
        from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `load'
        from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
        from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `each'
        from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `load_spec_files'
        from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/command_line.rb:22:in `run'
        from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/runner.rb:80:in `run'
        from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/runner.rb:17:in `block in autorun'
    /Users/macbookowner/.rvm/rubies/ruby-1.9.3-p448/bin/ruby -S rspec /Users/macbookowner/Desktop/learn_ruby-master/00_hello/hello_spec.rb -I/Users/macbookowner/Desktop/learn_ruby-master/00_hello -I/Users/macbookowner/Desktop/learn_ruby-master/00_hello/solution -f documentation -r ./rspec_config failed
    fname-lnames-macbook-pro:00_hello macbookowner$ 

我的问题:出了什么问题?我该如何解决?

的信息:

  1. 我在运行rvm 1.9.3和rvm 2.0.0
  2. 时遇到了相同/类似的错误
  3. 我在两个rvm版本上安装了“gem install rspec”
  4. 我最好的猜测是rake找不到hello.rb文件[我在Sublime Text 2中创建,并保存在macbookowner上 - >桌面]。当我在桌面上运行ls时,它会显示hello.rb。
  5. 提前致谢!

1 个答案:

答案 0 :(得分:0)

如果你看错误,

/Users/macbookowner/Desktop/learn_ruby-master/00_hello/hello_spec.rb:116:in 'require': cannot load such file -- hello (LoadError) 

它显示在hello_spec.rb中,在第116行,有一个失败的require 'hello'语句。可能该文件在指定的路径中不存在。