Rspec语法错误,期望关闭一个语句?

时间:2014-03-19 17:33:09

标签: ruby-on-rails ruby rspec

我正在玩rspec并遇到试图用Dir.glob检查的问题。看起来我在关闭我的Dir.stub语句时遇到错误,但我的所有括号都匹配了?

syntax error, unexpected tCONSTANT, expecting ')' (SyntaxError)  
Facter::Util::Resolution.stubs(:exe...

代码是

Dir.stubs(:glob).with("/opt/test/cli-*/checker").and_return(double("glob", :'exists?' => true)
Facter::Util::Resolution.stubs(:exec).with('checker -version').returns("Version:  1.5")

1 个答案:

答案 0 :(得分:2)

关闭paren缺少)

.and_return(double("glob", :'exists?' => true) <~~ here

写为

.and_return(double("glob", :'exists?' => true))