Sha256: 0c77c9079b991cb2f50709cec44f09d223952bb97be491b3f680e6797ac2951b

Contents?: true

Size: 1.08 KB

Versions: 11

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

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

describe ::Protobuf::Rpc::Zmq::Util do
  before(:each) do
    load 'protobuf/zmq.rb' 
    ::Protobuf::Rpc::Connector.connector_for_client(true)
  end

  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

11 entries across 11 versions & 1 rubygems

Version Path
protobuf-2.1.0 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.0.3 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.0.2 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.0.1 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.0.0 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.0.0.rc6 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.0.0.rc5 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.0.0.rc4 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.0.0.rc3 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.0.0.rc2 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.0.0.rc1 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb