Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby Gems在以编程方式运行rspec时丢失错误,但直接使用rspec命令可以正常工作_Ruby_Rspec_Rubygems - Fatal编程技术网

Ruby Gems在以编程方式运行rspec时丢失错误,但直接使用rspec命令可以正常工作

Ruby Gems在以编程方式运行rspec时丢失错误,但直接使用rspec命令可以正常工作,ruby,rspec,rubygems,Ruby,Rspec,Rubygems,当我以编程方式运行rspec(rspec::Core::Runner.run(['spec/api/my_spec.rb'])时,我发现gems缺失错误 /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:308:in `to_specs': Could not find 'em-synchrony' (>= 1.0.0) among 175 total gem(s) (Gem::MissingSpecError)

当我以编程方式运行rspec(rspec::Core::Runner.run(['spec/api/my_spec.rb'])时,我发现gems缺失错误

    /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:308:in `to_specs': Could not find 'em-synchrony' (>= 1.0.0) among 175 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/root/.gem/ruby/2.1.0:/usr/local/lib/ruby/gems/2.1.0:/usr/local/bundle', execute `gem env` for more information
但是当我使用rspec命令运行规范时,它工作得很好

rspec——模式规范/api/my_spec.rb——嵌套格式


提前感谢。

执行测试的代码中是否需要gem?执行测试的代码中是否需要gem?