gpt4 book ai didi

ruby - 当我在 Eclipse 下运行时,RSpec 找不到文件

转载 作者:太空宇宙 更新时间:2023-11-03 16:30:12 25 4
gpt4 key购买 nike

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

C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in require': cannot load such file -- spec (LoadError)
from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in
require' 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: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
'

我假设我没有正确配置它,但我正在努力在网上找到任何关于如何配置它的有用信息。谁能指出正确的方向让它发挥作用?

谢谢。

最佳答案

根据评论herehere将以下内容粘贴到顶部的 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

关于ruby - 当我在 Eclipse 下运行时,RSpec 找不到文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17477623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com