<commit_before>require 'spec_helper'

describe FluQ::DSL do

  let :subject do
    described_class.new reactor, FluQ.root.join('../scenario/config/test.rb')
  end

  it 'should find & configure input' do
    subject.input(:socket) do
      bind 'tcp://localhost:76543'
    end
    subject.should have(1).inputs
    reactor.inputs.should have(:no).actors
  end

  it 'should find & configure handler' do
    subject.handler(:forward) do
      to 'tcp://localhost:87654'
    end
    subject.should have(1).handlers
    reactor.should have(:no).handlers
  end

  it 'should find namespaced handler' do
    subject.handler(:custom, :test_handler) do
      to 'tcp://localhost:87654'
    end
    subject.should have(1).handlers
  end

  it 'should evaluate configuration' do
    subject.run<commit_msg>Be more explicit in specs<commit_after>require 'spec_helper'

describe FluQ::DSL do

  let :subject do
    described_class.new reactor, FluQ.root.join('../scenario/config/test.rb')
  end

  it 'should find & configure input' do
    subject.input(:socket) do
      bind 'tcp://localhost:76543'
    end
    subject.should have(1).inputs
    reactor.inputs.should have(:no).actors
  end

  it 'should find & configure handler' do
    subject.handler(:forward) do
      to 'tcp://localhost:87654'
    end
    subject.should have(1).handlers
    reactor.should have(:no).handlers
  end

  it 'should find namespaced handler' do
    subject.handler(:custom, :test_handler) do
      to 'tcp://localhost:87654'
    end
    subject.should have(1).handlers
    subject.handlers.last.first.should == FluQ::Handler::Custom::TestHandler
  end

  it 'should evaluate configuration' do
    subject.run
{'fraction_non_alphanumeric': 0.11170528817587641, 'fraction_numerical': 0.0213903743315508, 'mean_word_length': 3.2525252525252526, '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': '772198', 'n_tokens_mistral': 559, 'n_tokens_neox': 516, 'n_words': 135}