Sha256: e7168c165d3408a39d2209d1b063bde8f86345ff5842bf58241b302396281032

Contents?: true

Size: 951 Bytes

Versions: 4

Compression:

Stored size: 951 Bytes

Contents

describe Kanina::Server do
  before do
    @server = Class.new(Kanina::Server)
    @server.config = { host: 'localhost' }
  end
  describe '.status' do
    context 'when the server is not started' do
      it "returns 'off'" do
        expect(@server.status).to eql 'off'
      end
    end
    context 'when the server is started' do
      it "returns 'started'" do
        @server.start
        sleep(0.1)
        expect(@server.status).to eql 'started'
      end
    end
  end

  describe '.stop' do
    it 'closes the connection to rabbitmq' do
      @server.start
      sleep(0.1)
      expect(@server.status).to eql 'started'
      @server.stop
      expect(@server.status).to eql 'off'
    end
  end

  describe '.start' do
    it 'opens a connection to rabbitmq' do
      @server.start
      sleep(0.1)
      expect(@server.connection).to be_kind_of(Bunny::Session)
      expect(@server.channel).to be_kind_of(Bunny::Channel)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kanina-0.7.0 spec/kanina/server_spec.rb
kanina-0.6.2 spec/kanina/server_spec.rb
kanina-0.6.1 spec/kanina/server_spec.rb
kanina-0.6.0 spec/kanina/server_spec.rb