spec/onstomp/failover/client_spec.rb in onstomp-1.0.11 vs spec/onstomp/failover/client_spec.rb in onstomp-1.0.12

- old
+ new

@@ -52,10 +52,23 @@ retry_attempts: 2, ssl: { ca_file: 'ca.crt' }, login: 'user_name' }) end + + it 'passes the ssl settings to both clients in the pool' do + c = Client.new('failover:(stomp:///,stomp+ssl:///)', { + buffer: 'OnStomp::Failover::DummyBuffer', + retry_attempts: 2, + ssl: { ca_file: 'ca.crt' }, + login: 'user_name' + }) + + c.client_pool.clients.count.should == 2 + c.client_pool.clients[0].ssl.should == { ca_file: 'ca.crt' } + c.client_pool.clients[1].ssl.should == { ca_file: 'ca.crt' } + end end describe ".connected?" do it "should be connected if it has an active client that's connected" do active_client.stub(:connected? => true) @@ -68,11 +81,11 @@ it "should not be connected if it has no active client" do client.stub(:active_client => nil) client.connected?.should be_false end end - + describe ".connect" do it "should call reconnect" do client.should_receive(:reconnect).and_return(true) client.connect.should == client end @@ -92,11 +105,11 @@ end client.connect triggered.should be_true end end - + describe ".disconnect" do let(:connection) { mock('connection').tap do |m| m.extend OnStomp::Interfaces::ConnectionEvents end @@ -130,11 +143,11 @@ connection.trigger_event :on_closed, active_client, connection end Thread.pass while t.alive? actual_disconnect.call *args end - + active_client.should_receive(:disconnect).with(:header1 => 'value 1') client.disconnect :header1 => 'value 1' end it "should disconnect promptly if retrying exceeds maximum attempts" do client.retry_attempts = 3 @@ -156,10 +169,10 @@ actual_disconnect.call *args end client.disconnect :header1 => 'value 1' end end - + describe ".transmit" do it "should transmit on the active client if there is one" do active_client.should_receive(:transmit).with('test', :coming => 'home') client.transmit 'test', :coming => 'home' client.stub(:active_client => nil)