2

这有效:

[rails31]$ ruby -S rspec ./spec/models/domain_spec.rb 
*.

Pending:
  Domain add some examples to (or delete) /home/keith/Code/elements2/spec/models/domain_spec.rb
    # Not Yet Implemented
    # ./spec/models/domain_spec.rb:4

Finished in 0.04241 seconds
2 examples, 0 failures, 1 pending

但是我试图从执行以下命令的guard运行:

[rails31]$ /home/keith/.rbenv/versions/1.9.2-p290/bin/ruby -S rspec ./spec/models/domain_spec.rb 
/home/keith/.rbenv/versions/1.9.2-p290/bin/ruby: no Ruby script found in input (LoadError)

把它分解到足以执行我得到这个:

[rails31]$ /home/keith/.rbenv/versions/1.9.2-p290/bin/ruby ./spec/models/domain_spec.rb 
/home/keith/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0.rc1/lib/rspec/core/configuration.rb:335:in `rescue in debug=':  (RuntimeError)
**************************************************
no such file to load -- ruby-debug

If you have it installed as a ruby gem, then you need to either require
'rubygems' or configure the RUBYOPT environment variable with the value
'rubygems'.

...

这实际上是我首先开始的地方 - 我知道 rspec 尊重“不需要 ruby​​gems ”规则,所以也许我需要运行 rake。我对这个错误的最大问题是ruby1.9不存在“ruby-debug” - 它应该是ruby-debug19 - 那么这里发生了什么?

所以无论如何,我尝试使用 Rake:

[rails31]$ rake spec ./spec/models/domain_spec.rb 
(in /home/keith/Code/elements2)
rake aborted!
uninitialized constant Rake::DSL
...

我试过用谷歌搜索这个问题,但没有任何明显的问题出现,所以我真的很难过

更新:

好吧,在阅读了这篇文章之后,我设法解决了 rake 问题,但是现在当我运行 rake 时,我得到了这个:

[rails31]$ rake spec
(in /home/keith/Code/elements2)
/home/keith/.rbenv/versions/1.9.2-p290/bin/ruby -S rspec ./spec/models/domain_spec.rb
/home/keith/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rspec-core-2.8.0.rc1/lib/rspec/core/configuration.rb:335:in `rescue in debug=':  (RuntimeError)
...
4

0 回答 0