Sha256: b434cf3c4e37370cdf1add57f73e162f39f7750f2ed61f30b365240ff31c4001

Contents?: true

Size: 1022 Bytes

Versions: 1

Compression:

Stored size: 1022 Bytes

Contents

require 'spec_helper'

module AmazonProduct
  describe 'Synchrony adapter', :synchrony do
    before(:all) do
      require 'amazon_product/synchrony'
    end

    describe Request, :synchrony do
      let(:request) do
        req = AmazonProduct['us']
        req.configure do |c|
          c.key    = 'foo'
          c.secret = 'bar'
          c.tag    = 'baz'
        end
        req
      end

      it "uses an evented adapter" do
        request.adapter.should eql ::EM::HttpRequest
      end

      describe "#aget" do
        it "yields a response" do
          response = nil
          EM.synchrony do
            request.aget { |resp| response = resp }
            EM.stop
          end

          response.should be_a Response
        end
      end

      describe "#get" do
        it "returns a response" do
          response = nil
          EM.synchrony do
            response = request.get
            EM.stop
          end

          response.should be_a Response
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amazon_product-3.0.0.pre.1 spec/amazon_product/synchrony_spec.rb