Sha256: 1abfeb8c57fc2af5d7dab09ae6cbc8ea0a8e4ec3397a09de5215f934c69bb9da

Contents?: true

Size: 1.02 KB

Versions: 89

Compression:

Stored size: 1.02 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'
  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

89 entries across 89 versions & 1 rubygems

Version Path
protobuf-2.7.12 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.11-java spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.11 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.10-java spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.10 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.9-java spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.9 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.8-java spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.8 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.7-java spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.7 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.6-java spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.6 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.5-java spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.5 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.4-java spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.4 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.3-java spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.3 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.7.2-java spec/lib/protobuf/rpc/servers/zmq/util_spec.rb