Sha256: 49ec9ae595592cbd86608da1dca9353dc73aba83cceef867c7b689915c722878

Contents?: true

Size: 1.61 KB

Versions: 33

Compression:

Stored size: 1.61 KB

Contents

# encoding: utf-8

require "ostruct"
require "spec_helper"
require "amq/client"

describe AMQ::Client do
  if RUBY_PLATFORM =~ /java/
    ADAPTERS = {
      :event_machine => "Async::EventMachineClient"
    }
  else
    ADAPTERS = {
      :event_machine => "Async::EventMachineClient",
      :coolio        => "Async::CoolioClient"
    }
  end

  it "should have VERSION" do
    AMQ::Client::const_defined?(:VERSION).should be_true
  end

  ADAPTERS.each do |adapter_name, adapter_const_name|
    describe ".adapters" do
      before(:all) do
        @meta = AMQ::Client.adapters[adapter_name]
      end

      it "should provide info about path to the adapter" do
        require @meta[:path]
      end

      it "should provide info about const_name" do
        @meta[:const_name].should eql(adapter_const_name)
      end
    end
  end

  describe ".connect(settings = nil, &block)" do
    include EventedSpec::SpecHelper
    default_timeout 1

    context "with specified adapter" do
      it "should connect using event_machine adapter" do
        em do
          AMQ::Client.connect(:adapter => :event_machine) do |client|
            client.class.name.should eql("AMQ::Client::Async::EventMachineClient")
            done
          end
        end
      end # it

      it "should connect using coolio adapter", :nojruby => true do
        coolio do
          AMQ::Client.connect(:adapter => :coolio) do |client|
            client.class.name.should eql("AMQ::Client::Async::CoolioClient")
            done
          end
        end
      end # it
    end # context "with specified adapter"
  end # describe .connect
end # describe AMQ::Client

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
amq-client-1.0.4 spec/unit/client_spec.rb
amq-client-1.0.3 spec/unit/client_spec.rb
amq-client-1.1.0.pre1 spec/unit/client_spec.rb
amq-client-1.0.2 spec/unit/client_spec.rb
amq-client-1.0.1 spec/unit/client_spec.rb
amq-client-1.0.0 spec/unit/client_spec.rb
amq-client-0.9.12 spec/unit/client_spec.rb
amq-client-0.9.11 spec/unit/client_spec.rb
amq-client-0.9.10 spec/unit/client_spec.rb
amq-client-0.9.9 spec/unit/client_spec.rb
amq-client-0.9.8 spec/unit/client_spec.rb
amq-client-0.9.7 spec/unit/client_spec.rb
amq-client-0.9.6 spec/unit/client_spec.rb
amq-client-0.9.5 spec/unit/client_spec.rb
amq-client-0.9.4 spec/unit/client_spec.rb
amq-client-1.0.0.pre2 spec/unit/client_spec.rb
amq-client-0.9.3 spec/unit/client_spec.rb
amq-client-1.0.0.pre1 spec/unit/client_spec.rb
amq-client-0.9.2 spec/unit/client_spec.rb
amq-client-0.9.1 spec/unit/client_spec.rb