新手问题 求教育,从 github 下载 mongoid 后,rspec spec/ 报错..

gsky · 2014年03月16日 · 最后由 hayeah 回复于 2014年03月16日 · 2864 次阅读

从 github 下载 mongoid 后,在虚拟机执行: [email protected]:/vagrant/mongoid# rspec spec/

执行失败,报错信息: /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:386:in load': /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:273: syntax error, unexpected ':', expecting tASSOC (SyntaxError) conflicts: { "$pushAll" => ^ /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:279: syntax error, unexpected '}', expecting kEND /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:286: syntax error, unexpected kDO_BLOCK, expecting kEND /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:290: syntax error, unexpected kDO_BLOCK, expecting kEND /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:303: syntax error, unexpected ':', expecting tASSOC conflicts: { "$pushAll" => ^ /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:309: syntax error, unexpected '}', expecting kEND /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:316: syntax error, unexpected kDO_BLOCK, expecting kEND /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:320: syntax error, unexpected kDO_BLOCK, expecting kEND /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:333: syntax error, unexpected ':', expecting tASSOC conflicts: { "$pushAll" => ^ /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:339: syntax error, unexpected '}', expecting kEND /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:354: syntax error, unexpected kDO_BLOCK, expecting kEND /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:369: syntax error, unexpected kDO_BLOCK, expecting kEND /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:396: syntax error, unexpected kDO_BLOCK, expecting kEND /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:400: syntax error, unexpected kDO_BLOCK, expecting kEND /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:416: syntax error, unexpected ':', expecting tASSOC /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:418: syntax error, unexpected '}', expecting kEND /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:431: syntax error, unexpected kDO_BLOCK, expecting kEND /vagrant/mongoid/spec/mongoid/atomic/modifiers_spec.rb:456: syntax error, unexpected $end, expecting kEND from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:386:inload_spec_files' from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:386:in map' from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:386:inload_spec_files' from /usr/lib/ruby/vendor_ruby/rspec/core/command_line.rb:18:in run' from /usr/lib/ruby/vendor_ruby/rspec/core/runner.rb:55:inrun_in_process' from /usr/lib/ruby/vendor_ruby/rspec/core/runner.rb:46:in run' from /usr/lib/ruby/vendor_ruby/rspec/core/runner.rb:10:inautorun' from /usr/bin/rspec:4

这个是因为我下的版本不对吗?。。我是用的 v4.0.0.beta1 的分支: git checkout -b explore-mongoid v4.0.0.beta1

因为你的 rspec 用了 ruby 1.8

#1 楼 @luikore 谢谢,我去检查一下,昨晚上才搞好的虚拟机。。。

@luikore 我把 ruby 更新到 2.0,还是报这个错,可能是什么原因呢?

@gsky 应该是 Mongoid 版本的问题。之前其他同学有越到这个问题。

@hayeah 这个正确的版本应该用哪一个呢?

@gsky 2.4.9. 升级后记得重启服务

需要 登录 后方可回复, 如果你还没有账号请 注册新账号