<commit_before>require "spec_helper"
require "teabag/console"

describe Teabag::Console do

  let(:server) { mock(start: nil, url: "http://url.com") }

  before do
    subject.instance_variable_set(:@server, server)
    subject.instance_variable_set(:@suites, [:default, :foo])
  end

  describe "#execute" do

    before do
      STDOUT.stub(:print)
    end

    it "starts the server and calls run" do
      STDOUT.should_receive(:print).with("Starting server...\n")
      subject.should_receive(:start_server)
      STDOUT.should_receive(:print).with("Teabag running default suite at http://url.com/teabag/default...\n")
      STDOUT.should_receive(:print).with("Teabag running foo suite at http://url.com/teabag/foo...\n")
      subject.should_receive(:run_specs).twice.and_return(2)
      result = subject.execute
      expect(result).to be(true)
    end

    it "starts the server and calls run" do
      subject.should_receive(:start_server)
      subject.should_receive(:run_specs).twice.and_return(0)
      result = subject.execute
      expect(result).to be(false)<commit_msg>making the specs pass.<commit_after>require "spec_helper"
require "teabag/console"

describe Teabag::Console do

  let(:server) { mock(start: nil, url: "http://url.com") }

  before do
    subject.instance_variable_set(:@server, server)
    subject.instance_variable_set(:@suites, [:default, :foo])
  end

  describe "#execute" do

    before do
      STDOUT.stub(:print)
    end

    it "starts the server and calls run" do
      STDOUT.should_receive(:print).with("Starting server...\n")
      subject.should_receive(:start_server)
      STDOUT.should_receive(:print).with("Teabag running default suite at http://url.com/teabag/default...\n")
      STDOUT.should_receive(:print).with("Teabag running foo suite at http://url.com/teabag/foo...\n")
      subject.should_receive(:run_specs_with_selenium).twice.and_return(2)
      result = subject.execute
      expect(result).to be(true)
    end

    it "starts the server and calls run" do
      subject.should_receive(:start_server)
      subject.should_receive(:run_specs_with_selenium).twice.and_return(0)
      result = subject.execute
      expect(result).to be(false)
{'fraction_non_alphanumeric': 0.12992304210049796, 'fraction_numerical': 0.0018107741059302852, 'mean_word_length': 3.6526315789473682, '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': '6482955', 'n_tokens_mistral': 741, 'n_tokens_neox': 694, 'n_words': 142}