RubyMine IDE无法在Spec目录中找到规格文件

问题描述:

像往常一样,我已经将Ruby项目加载到RubyMine中,该项目的规格文件位于spec目录中。右键单击并选择任何单个规格文件上的“运行”可以正确运行它。右击并在specs目录中选择“运行所有”使每个测试失败,出现以下消息:RubyMine IDE无法在Spec目录中找到规格文件

无法加载:/用户/纳撒尼尔/回购/关闭的Web /规格/组成物/分析/ analysis_data_spec.rb:1个 异常消息:无法加载这样的文件 - spec_helper

里面的启动配置中,“测试文件夹”似乎是正确设置:

/Users/nathaniel/repos/close-web/spec 

和工作直销保守党还有:

/Users/nathaniel/repos/close-web 

Ruby的参数设置如下:

-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) -Itest 

(还有就是RubyMine的网站-Itest需要一些指示。)在捆扎机选项卡“运行脚本'包的上下文'也被检查。我不清楚RubyMine可能需要什么来递归地查找和执行测试。从命令行运行它们可以正常工作:

~repos/closeweb $ bundle exec rspec spec 
... (all the tests running) 

Finished in 6 minutes 27 seconds (files took 13.39 seconds to load) 
1054 examples, 0 failures, 108 pending 

这里的所有测试都不会运行?

+1

鉴于您的文件夹的名字叫做'spec',不'test',我相信你需要'-Ispec',而不是'-Itest'。 –

+0

@TomLord就是这样!谢谢。我没有意识到那是那个国旗的意思。如果你想回答我会接受它。 –

鉴于您的文件夹被称为spec,而不是test,您需要-Ispec而不是-Itest

换句话说,你的RubyMine参数应该是:

-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) -Ispec 

ruby man page

-I directory Used to tell Ruby where to load the library scripts. 
       Directory path will be added to the load-path variable ($:)