0

I am using the happening gem, a event-machine library to persist files on S3. when i run rspec tests to "GET" a file from the aws bucket, it errors out.

Error 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'\

Has any body faced a similar issue ?

thakns

Tombart
  • 30,520
  • 16
  • 123
  • 136
Tony45
  • 3
  • 1
  • 3

1 Answers1

0

This could be solved by adding with_api block

  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

where API is your api class which inherits from Goliath::API

And to spec_helper.rb add:

require 'goliath/test_helper'
RSpec.configure do |c|
  c.include Goliath::TestHelper, :example_group => {
    :file_path => /spec\/api/
  }
end
Tombart
  • 30,520
  • 16
  • 123
  • 136