Sha256: 89acd7d40dae2fbf5dd12212b811eda2bd88257750e72a8a2859338aa9b5033d
Contents?: true
Size: 1.29 KB
Versions: 13
Compression:
Stored size: 1.29 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 describe '.resolve_ip' do it 'resolves ips' do expect(subject.resolve_ip('127.0.0.1')).to eq('127.0.0.1') end it 'resolves non ips' do expect(subject.resolve_ip('localhost')).to eq('127.0.0.1') end end end
Version data entries
13 entries across 13 versions & 2 rubygems