これは機能します:
[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が「 rubygemsを必要としない」ルールを尊重していることを知っているので、おそらく 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
...
私は問題をグーグルで調べてみましたが、明らかなことは何も起きていないので、本当に困惑しています
アップデート:
この投稿を読んだ後、レーキの問題を解決することができましたが、レーキを実行すると次のようになります。
[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)
...