Sha256: 7f1fd22fb2d5d0005fe03b2f9c01c844044583503a6ad6dd66fc3907fdd8e8f8

Contents?: true

Size: 819 Bytes

Versions: 6

Compression:

Stored size: 819 Bytes

Contents

require 'spec_helper'

describe Mongo::Socket::Unix do

  let(:socket) do
    described_class.new("/tmp/mongodb-#{SpecConfig.instance.any_port}.sock", 5)
  end

  describe '#connect!' do

    before do
      socket.connect!
    end

    after do
      socket.close
    end

    it 'connects to the server' do
      expect(socket).to be_alive
    end
  end

  describe '#alive?' do

    context 'when the socket is connected' do

      before do
        socket.connect!
      end

      after do
        socket.close
      end

      it 'returns true' do
        expect(socket).to be_alive
      end
    end

    context 'when the socket is not connected' do

      before do
        socket.close
      end

      it 'raises error' do
        expect { socket.alive? }.to raise_error(IOError)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mongo-2.7.2 spec/mongo/socket/unix_spec.rb
mongo-2.7.1 spec/mongo/socket/unix_spec.rb
mongo-2.7.0 spec/mongo/socket/unix_spec.rb
mongo-2.7.0.rc0 spec/mongo/socket/unix_spec.rb
mongo-2.6.4 spec/mongo/socket/unix_spec.rb
mongo-2.6.2 spec/mongo/socket/unix_spec.rb