我正在使用正在发生的gem,这是一个事件机器库,用于在S3上持久化文件。当我运行rspec测试从aws桶"GET"一个文件时,它出错了。
错误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'
有人遇到过类似的问题吗?
thakns
这可以通过添加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
是继承自Goliath::API
的api类
对spec_helper.rb
添加:
require 'goliath/test_helper'
RSpec.configure do |c|
c.include Goliath::TestHelper, :example_group => {
:file_path => /spec/api/
}
end