Sha256: 8d67b95040eceb2431bd290cd99b77da813f6e6ad825a9a8217258c4c57c3419

Contents?: true

Size: 1.06 KB

Versions: 30

Compression:

Stored size: 1.06 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, :test)
      }.to raise_error(/test/)
    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, :test)
      }.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, :test)
      }.to_not raise_error
    end

    it 'does nothing if the error code is == 0' do
      expect {
        subject.zmq_error_check(0, :test)
      }.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

30 entries across 30 versions & 1 rubygems

Version Path
protobuf-2.8.13 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.12 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.11 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.10 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.9 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.8 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.7 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.6 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.5 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.4 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.3 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.2 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.1 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.0 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.0.beta9-java spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.0.beta9 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.0.beta8-java spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.0.beta8 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.0.beta6-java spec/lib/protobuf/rpc/servers/zmq/util_spec.rb
protobuf-2.8.0.beta6 spec/lib/protobuf/rpc/servers/zmq/util_spec.rb