Sha256: 70bab9138341369f0ef76050e52c432825e7a4f50e60a6ac3dba692a15769ec2

Contents?: true

Size: 993 Bytes

Versions: 4

Compression:

Stored size: 993 Bytes

Contents

require 'spec_helper'

class UtilTest
  include ::Protobuf::Rpc::Zmq::Util
end

describe ::Protobuf::Rpc::Zmq::Util do
  subject { UtilTest.new }
  describe '#zmq_error_check' do
    it 'raises when the error code is less than 0' do
      expect {
        subject.zmq_error_check(-1)
      }.to raise_error
    end

    it 'retrieves the error string from ZeroMQ' do
      ZMQ::Util.stub(:error_string).and_return('an error from zmq')
      expect {
        subject.zmq_error_check(-1)
      }.to raise_error(RuntimeError, /an error from zmq/i)
    end

    it 'does nothing if the error code is > 0' do
      expect {
        subject.zmq_error_check(1)
      }.to_not raise_error
    end

    it 'does nothing if the error code is == 0' do
      expect {
        subject.zmq_error_check(0)
      }.to_not raise_error
    end
  end

  describe '#log_signature' do
    it 'returns the signature for the log' do
      subject.log_signature.should include('server', 'UtilTest')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
protobuf-1.4.2 spec/unit/rpc/servers/zmq/util_spec.rb
protobuf-1.4.1 spec/unit/rpc/servers/zmq/util_spec.rb
protobuf-1.4.0 spec/unit/rpc/servers/zmq/util_spec.rb
protobuf-1.3.0 spec/unit/rpc/servers/zmq/util_spec.rb