2

コマンド ラインから rspec テストを実行すると、問題なく動作します。しかし、Eclipse 内から (DLTK を使用して) 同じテストを実行しようとすると、次のエラーが発生します。

C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45: require': cannot load such file -- spec (LoadError) from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:inC:/Users/Tim/.eclipse/org.eclipse.platform_4.3.0_1709980481_win32_win32_x86_64/configuration/org. eclipse.osgi/bundles/886/1/.cp/testing/dltk-rspec-runner.rb:12:in rescue in <main>' from C:/Users/Tim/.eclipse/org.eclipse.platform_4.3.0_1709980481_win32_win32_x86_64/configuration/org.eclipse.osgi/bundles/886/1/.cp/testing/dltk-rspec-runner.rb:3:in'

正しく構成されていないと思いますが、構成方法についてオンラインで役立つものを見つけるのに苦労しています。誰かがそれを機能させるために正しい方向に向けることができますか?

ありがとう。

4

1 に答える 1

1

ここここのコメントに従って、以下を上部に貼り付けますspec_helper.rb(Eclipse Keplerで試しました):

# Taken from a helpful comments:
# http://www.eclipse.org/forums/index.php/mv/msg/202462/846682/#msg_846682
# http://net.tutsplus.com/tutorials/ruby/ruby-for-newbies-testing-with-rspec/#comment-693919160
# RSpec needs the following lines to have it run from Eclipse Helios (or Kepler <ed: mE>)or Komodo Edit 7.0
version = ">= 0"

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end

gem 'rspec-core', version
load Gem.bin_path('rspec-core', 'rspec', version)
# end of RSpec parameters
于 2013-08-28T15:50:36.953 に答える