Ruby RSpec can';在Eclipse下运行时找不到文件

Ruby RSpec can';在Eclipse下运行时找不到文件,ruby,eclipse,rspec,dltk,Ruby,Eclipse,Rspec,Dltk,当我从命令行运行rspec测试时,它们工作得很好。但是,当我尝试在Eclipse中运行相同的测试(使用DLTK)时,会出现以下错误: C:/Ruby200/lib/ruby/2.0.0/rubygems/core\u ext/kernel\u require.rb:45:inrequire”:无法加载这样的文件--spec(LoadError) 来自C:/Ruby200/lib/ruby/2.0.0/rubygems/core\u ext/kernel\u require.rb:45:inreq

当我从命令行运行rspec测试时,它们工作得很好。但是,当我尝试在Eclipse中运行相同的测试(使用DLTK)时,会出现以下错误:

C:/Ruby200/lib/ruby/2.0.0/rubygems/core\u ext/kernel\u require.rb:45:in
require”:无法加载这样的文件--spec(LoadError)
来自C:/Ruby200/lib/ruby/2.0.0/rubygems/core\u ext/kernel\u require.rb:45:in
require' 来自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:12:in
rescue in'
来自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
'

我想我没有正确地配置它,但我正在努力在网上找到任何关于如何配置它的有用信息。有人能给我指出正确的方向让它工作吗

谢谢。

根据评论,将以下内容粘贴到顶部的
spec\u helper.rb
中(使用Eclipse开普勒进行了尝试):

#摘自有用的评论:
# 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需要以下几行代码才能从EclipseHelios(或开普勒)或KomodoEdit7.0运行
version=“>=0”
如果ARGV.first=~/^(.*)和Gem::Version.correct$1那么
版本=$1
ARGV.shift
结束
gem“rspec核心”,版本
加载Gem.bin_路径('rspec-core','rspec',version)
#RSpec参数结束

在Ubuntu 13.04、Eclipse Juno Service Release 2上相同,本地安装了动态语言工具包-Ruby Development Tools 5.0.0.201306060709 org.Eclipse.dltk.Ruby.feature.groups我在哪里添加此代码(即spec_helper.rb)?我是从这里来到你的帖子的——我相信
spec\u helper.rb
是Rails的东西,包含在所有Rails测试中,因此是RSpec配置的好地方。我会尝试将它粘贴到EclipseRSpec正在执行的任何文件中,或者从Rails的书中选取一页,并在所有测试中包括一个特定的设置文件。@Amadan-请告诉我将代码放在哪里。我只是试试运气,把它放在“C:\Ruby\lib\Ruby\site\u Ruby\1.8\rubygems\custom\u require.rb”中。现在,无法加载rspec/预期错误。不,不是
custom\u require.rb
。只是你的档案的顶部。该文件包含您的测试。如果它不起作用,请记住,我不能测试任何东西,因为我没有Eclipse环境。
# 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