Sha256: e04bd4009b0a1a126209ded143738a4ce5810c04adc313e493668fde1df7023b

Contents?: true

Size: 1.19 KB

Versions: 11

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'
require 'protobuf/rpc/servers/zmq/server'

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

  describe '.running?' do
    it 'returns true if running' do
      described_class.instance_variable_set(:@running, true)
      described_class.running?.should be_true
    end

    it 'returns false if not running' do
      described_class.instance_variable_set(:@running, false)
      described_class.running?.should be_false
    end
  end

  describe '.stop' do
    # keep threads instance variable from retaining any thread mocks we've
    # created (breaks tests down the line, otherwise)
    after(:each) do
      described_class.instance_variable_set(:@threads, [])
    end

    it 'lets all threads stop' do
      thread_mock = double(Thread)
      thread_mock.should_receive(:join)
      described_class.instance_variable_set(:@threads, [thread_mock])
      described_class.stop
    end

    it 'sets running to false' do
      described_class.instance_variable_set(:@threads, [])
      described_class.stop
      described_class.instance_variable_get(:@running).should be_false
    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/server_spec.rb
protobuf-2.0.3 spec/lib/protobuf/rpc/servers/zmq/server_spec.rb
protobuf-2.0.2 spec/lib/protobuf/rpc/servers/zmq/server_spec.rb
protobuf-2.0.1 spec/lib/protobuf/rpc/servers/zmq/server_spec.rb
protobuf-2.0.0 spec/lib/protobuf/rpc/servers/zmq/server_spec.rb
protobuf-2.0.0.rc6 spec/lib/protobuf/rpc/servers/zmq/server_spec.rb
protobuf-2.0.0.rc5 spec/lib/protobuf/rpc/servers/zmq/server_spec.rb
protobuf-2.0.0.rc4 spec/lib/protobuf/rpc/servers/zmq/server_spec.rb
protobuf-2.0.0.rc3 spec/lib/protobuf/rpc/servers/zmq/server_spec.rb
protobuf-2.0.0.rc2 spec/lib/protobuf/rpc/servers/zmq/server_spec.rb
protobuf-2.0.0.rc1 spec/lib/protobuf/rpc/servers/zmq/server_spec.rb