<commit_before>require "spec_helper"

include Guard

describe UI do
  let(:interactor) { instance_double(Guard::Interactor) }

  before do
    allow(Guard::Interactor).to receive(:new).and_return(interactor)

    allow(Notifier).to receive(:turn_on) {}

    # The spec helper stubs all UI classes, so other specs doesn't have
    # to explicit take care of it. We unstub and move the stubs one layer
    # down just for this spec.
    allow(UI).to receive(:info).and_call_original
    allow(UI).to receive(:warning).and_call_original
    allow(UI).to receive(:error).and_call_original
    allow(UI).to receive(:deprecation).and_call_original
    allow(UI).to receive(:debug).and_call_original

    allow(UI.logger).to receive(:info)
    allow(UI.logger).to receive(:warn)
    allow(UI.logger).to receive(:error)
    allow(UI.logger).to receive(:debug)

    allow($stderr).to receive(:print)
  end

  after do
    UI.options = {
      level: :info,
      device: $stderr,<commit_msg>stub out evaluator in ui<commit_after>require "spec_helper"

include Guard

describe UI do
  let(:interactor) { instance_double(Guard::Interactor) }
  let(:evaluator) { instance_double(Guard::Guardfile::Evaluator) }

  before do
    allow(Guard::Interactor).to receive(:new).and_return(interactor)

    allow(Notifier).to receive(:turn_on) {}

    # The spec helper stubs all UI classes, so other specs doesn't have
    # to explicit take care of it. We unstub and move the stubs one layer
    # down just for this spec.
    allow(UI).to receive(:info).and_call_original
    allow(UI).to receive(:warning).and_call_original
    allow(UI).to receive(:error).and_call_original
    allow(UI).to receive(:deprecation).and_call_original
    allow(UI).to receive(:debug).and_call_original

    allow(UI.logger).to receive(:info)
    allow(UI.logger).to receive(:warn)
    allow(UI.logger).to receive(:error)
    allow(UI.logger).to receive(:debug)

    allow($stderr).to receive(:print)

    allow(Guard::Guardfile::Evaluator).to receive(:new).and_return(evaluator)
    allow(evaluator).to receive(:evaluate_guardfile)
  end

  after do
    UI.options = {
      level: :info,
      device: $stderr,
{'fraction_non_alphanumeric': 0.12327506899724011, 'fraction_numerical': 0.0, 'mean_word_length': 4.141843971631205, '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': '5799628', 'n_tokens_mistral': 690, 'n_tokens_neox': 675, 'n_words': 157}