Sha256: e374c48405971dfd24cf1a3070a698ba83c34bd5669394ed1a48ceb379b1dda0

Contents?: true

Size: 944 Bytes

Versions: 4

Compression:

Stored size: 944 Bytes

Contents

require 'spec_helper'

module Sucker
  describe 'Synchrony driver', :synchrony do
    before(:all) do
      require 'sucker/synchrony'
    end

    describe Request, :synchrony do
      let(:request) do
        Request.new(
          :locale => :us,
          :key    => 'key',
          :secret => 'secret')
      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

4 entries across 4 versions & 1 rubygems

Version Path
sucker-2.1.0 spec/sucker/synchrony_spec.rb
sucker-2.0.0 spec/sucker/synchrony_spec.rb
sucker-2.0.0.pre.5 spec/sucker/synchrony_spec.rb
sucker-2.0.0.pre.4 spec/sucker/synchrony_spec.rb