Sha256: 99800662bc318503f11356f574b1ca568e4692857388db77e526ed8c0edc8823

Contents?: true

Size: 1.12 KB

Versions: 22

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'
require 'integration/eventmachine/spec_helper'

#
# We assume that default connection settings (amqp://guest:guest@localhost:5672/) should work
#
describe AMQ::Client::EventMachineClient, "Connection.Start" do
  include EventedSpec::SpecHelper
  default_timeout 0.5

  context "with valid credentials" do
    it "should trigger the callback" do
      em do
        AMQ::Client::EventMachineClient.connect do |client|
          done
        end
      end
    end
  end

  context "with invalid credentials" do
    context "when given an errback" do
      it "should trigger the errback" do
        em do
          AMQ::Client::EventMachineClient.connect(:port => 12938, :on_tcp_connection_failure => proc { done }) do |client|
            raise "This callback should never happen"
          end
        end
      end
    end

    context "when given no errback" do
      it "should raise an error" do
        expect {
          em do
            AMQ::Client::EventMachineClient.connect(:port => 12938) { }
            done(0.5)
          end
        }.to raise_error(AMQ::Client::TCPConnectionFailed)
      end
    end
  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
amq-client-0.7.0.alpha35 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha34 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha33 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha32 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha31 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha30 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha29 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha28 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha27 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha26 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha25 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha24 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha23 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha22 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha21 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha20 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha19 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha18 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha17 spec/integration/eventmachine/connection_start_spec.rb
amq-client-0.7.0.alpha16 spec/integration/eventmachine/connection_start_spec.rb