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.2.5 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.2.4 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.2.3 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.2.2 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.2.1 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.2.0 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.1.3 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.1.2 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.1.1 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb