<commit_before>require 'spec_helper'

describe Travis::Worker::Reporters::LogStreamer do
  include_context 'hot_bunnies connection'

  let(:channel)     { connection.create_channel }
  let(:routing_key) { 'reporting.jobs.logs' }
  let(:queue)       { channel.queue(routing_key, :durable => true) }
  let(:reporting_exchange) { channel.exchange('reporting', :type => :topic, :durable => true) }
  let(:reporter)    { described_class.new('staging-1', connection.create_channel, connection.create_channel, routing_key) }

  include Travis::Worker::Utils::Serialization

  describe 'notify' do
    before :each do
      queue.purge
      queue.bind(reporting_exchange, :routing_key => routing_key)
    end

    it 'publishes log chunks' do
      reporter.notify('build:log', :log => '...')
      sleep 0.5
      meta, payload = queue.get

      decode(payload).should == { :log => '...', :uuid => Travis.uuid }
      meta.properties.type.should == 'build:log'
    end
  end
end
<commit_msg>correct the log streamer spec<commit_after>require 'spec_helper'

describe Travis::Worker::Reporters::LogStreamer do
  include_context 'hot_bunnies connection'

  let(:channel)     { connection.create_channel }
  let(:routing_key) { 'reporting.jobs.logs' }
  let(:queue)       { channel.queue(routing_key, :durable => true) }
  let(:reporting_exchange) { channel.exchange('reporting', :type => :topic, :durable => true) }
  let(:reporter)    { described_class.new('staging-1', connection.create_channel, connection.create_channel) }

  include Travis::Worker::Utils::Serialization

  describe 'notify' do
    before :each do
      queue.purge
      queue.bind(reporting_exchange, :routing_key => routing_key)
    end

    it 'publishes log chunks' do
      reporter.notify('build:log', :log => '...')
      sleep 0.5
      meta, payload = queue.get

      decode(payload).should == { :log => '...', :uuid => Travis.uuid }
      meta.properties.type.should == 'build:log'
    end
  end
end

{'fraction_non_alphanumeric': 0.14227848101265822, 'fraction_numerical': 0.0030379746835443038, 'mean_word_length': 3.7729468599033815, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '5545979', 'n_tokens_mistral': 639, 'n_tokens_neox': 607, 'n_words': 125}