0

我正在使用正在发生的 gem,这是一个事件机器库,用于在 S3 上保存文件。当我运行 rspec 测试以从 aws 存储桶中“获取”一个文件时,它会出错。

错误 O/P:

    RuntimeError: eventmachine not initialized: evma_connect_to_server
/home/ubuntu/.rvm/gems/ruby-1.9.3-p392/gems/eventmachine-1.0.3/lib/eventmachine.rb:665:in `connect_server'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p392/gems/eventmachine-1.0.3/lib/eventmachine.rb:665:in `bind_connect'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p392/gems/em-http-request-1.0.3/lib/em-http/http_connection.rb:54:in `activate_connection'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p392/gems/em-http-request-1.0.3/lib/em-http/http_connection.rb:89:in `setup_request'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p392/gems/em-http-request-1.0.3/lib/em-http/http_connection.rb:4:in `get'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p392/gems/happening-0.2.5/lib/happening/s3/request.rb:35:in `execute'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p392/gems/happening-0.2.5/lib/happening/s3/item.rb:44:in `get'\

有没有机构遇到过类似的问题?

谢谢

4

1 回答 1

0

这可以通过添加with_api块来解决

  it "should return pong response" do
    with_api API do
      get_request(path: "/api/ping") do |async|
        async.response.should == { ping: "pong" }.to_json
      end
    end
  end

API继承自的 api 类在哪里Goliath::API

spec_helper.rb添加:

require 'goliath/test_helper'
RSpec.configure do |c|
  c.include Goliath::TestHelper, :example_group => {
    :file_path => /spec\/api/
  }
end
于 2013-12-04T23:11:24.973 回答