Sha256: f37e9e45dd2d2ff1db2354cadda508eb6c32978ac51c0a88a299415e1436d3fc

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

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

describe Protobuf::Rpc::Zmq::Server do
  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

4 entries across 4 versions & 1 rubygems

Version Path
protobuf-1.4.2 spec/unit/rpc/servers/zmq/server_spec.rb
protobuf-1.4.1 spec/unit/rpc/servers/zmq/server_spec.rb
protobuf-1.4.0 spec/unit/rpc/servers/zmq/server_spec.rb
protobuf-1.3.0 spec/unit/rpc/servers/zmq/server_spec.rb