<commit_before>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
    it 'lets all threads stop' do
      thread_mock = double(Thread)
      thread_mock.should_receive(:join)
      described_class.instance_variable_set(:@threads, [thread_mock])<commit_msg>ensuring @threads variable is clean after mocking Thread<commit_after>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])
{'fraction_non_alphanumeric': 0.08955223880597014, 'fraction_numerical': 0.0, 'mean_word_length': 3.9968944099378882, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '238427', 'n_tokens_mistral': 472, 'n_tokens_neox': 459, 'n_words': 123}