Sha256: 89ded733e10563dbc6d1b7ff2350659643117f38e007ae81f005e08b014ff74d

Contents?: true

Size: 875 Bytes

Versions: 10

Compression:

Stored size: 875 Bytes

Contents

require 'spec_helper'

describe Mongo::Socket::Unix do

  let(:path) { "/tmp/mongodb-#{SpecConfig.instance.any_port}.sock" }

  let(:socket) do
    described_class.new(path, 5)
  end

  describe '#human_address' do
    it 'returns the path' do
      expect(socket.send(:human_address)).to eq(path)
    end
  end

  describe '#connect!' do

    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

      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

10 entries across 10 versions & 1 rubygems

Version Path
mongo-2.13.3 spec/mongo/socket/unix_spec.rb
mongo-2.14.1 spec/mongo/socket/unix_spec.rb
mongo-2.15.0.alpha spec/mongo/socket/unix_spec.rb
mongo-2.13.2 spec/mongo/socket/unix_spec.rb
mongo-2.14.0 spec/mongo/socket/unix_spec.rb
mongo-2.14.0.rc1 spec/mongo/socket/unix_spec.rb
mongo-2.13.1 spec/mongo/socket/unix_spec.rb
mongo-2.13.0 spec/mongo/socket/unix_spec.rb
mongo-2.13.0.rc1 spec/mongo/socket/unix_spec.rb
mongo-2.13.0.beta1 spec/mongo/socket/unix_spec.rb