Sha256: 433b6eab27b45879a3dc606ab8e36eb0d2e98fcf4e8284ff3736f900756ed1ca

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

require File.dirname(File.expand_path(__FILE__)) + '/spec_helper.rb'

describe JSparrow::Interactors::Client do

  subject do
    new_jms_client
  end
  
  context 'when created' do
  
    it 'should be started and stoped' do
      subject.start
    
      subject.is_started?.should be true
      subject.is_stoped?.should be false
    
      subject.stop
    
      subject.is_started?.should be false
      subject.is_stoped?.should be true
    end
  
    it 'should not be started if already is' do
      subject.start
    
      lambda {
          subject.start
        }.should raise_error JSparrow::Connection::InvalidStateError
    
      subject.stop
    end
  
    it 'should not be stoped if already is' do
      subject.start
      subject.stop
    
      lambda {
          subject.stop
        }.should raise_error JSparrow::Connection::InvalidStateError
    end
  end
  
  context 'when started' do

    before(:all) do
      subject.start
    end

    after(:all) do
      subject.stop
    end

    it 'should allow get a Sender for a Queue' do
      subject.queue_sender(:test_queue).should_not be nil
    end

    it 'should allow get a Receiver for a Queue' do
      subject.queue_receiver(:test_queue).should_not be nil
    end

    it 'should allow get a Sender for a Topic' do
      subject.topic_sender(:test_topic).should_not be nil
    end

    it 'should allow get a Receiver for a Topic' do
      subject.topic_receiver(:test_topic).should_not be nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jsparrow-1.1.4 spec/client_spec.rb