Sha256: 16e7d7e869d2ba084bbeb5a99ff04163b08c0f520cdaace21925e6c419dc43c9

Contents?: true

Size: 547 Bytes

Versions: 2

Compression:

Stored size: 547 Bytes

Contents

RSpec.describe NanomsgTransport::SocketError do
  subject(:error) { NanomsgTransport::SocketError.new 5 }

  let(:nanomsg_api) { spy nn_strerror: 'No u' }

  before do
    stub_const 'NNCore::LibNanomsg', nanomsg_api
  end

  describe '#to_s' do
    it 'should ask nanomsg for the meaning of the errno' do
      error.to_s

      expect(nanomsg_api).to have_received(:nn_strerror).with 5
    end

    it 'should provide a human readable error message' do
      expect(error.to_s).to eq "Last nanomsg API call failed with 'No u'"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aggro-0.0.3 spec/lib/aggro/nanomsg_transport/socket_error_spec.rb
aggro-0.0.2 spec/lib/aggro/nanomsg_transport/socket_error_spec.rb