<commit_before>require 'spec_helper'

module FarmGame
  describe Game do
    let(:stringio) { StringIO.new }

    subject do
      Game.new stringio
    end

    its(:board) { should be_a FarmGame::Board }

    it "should always use the same board" do
      subject.board.should be subject.board
    end

    it "s board should know its game" do
      subject.board.game.should be subject
    end

    it { should have(40).squares }

    its :squares do
      subject.all? { |s| s.should be_a FarmGame::Square }
    end

    its(:die) { should be_a FarmGame::Die }

    its(:players) { should be_a FarmGame::PlayerCollection }
    it { should have(0).players }

    describe "#play" do
      before { subject.play }

      it "should welcome the user to the game" do
        stringio.string.should include("Welcome")
      end

      it "should create two players" do
        subject.should have(2).players
        players = subject.players
        players[0].name.should be == '1'
        players[1].name.should be == '2'
      end
<commit_msg>Setup fake input in tests<commit_after>require 'spec_helper'

module FarmGame
  describe Game do
    let(:output) { StringIO.new }
    let(:input) { StringIO.new }

    subject do
      Game.new output, input
    end

    its(:board) { should be_a FarmGame::Board }

    it "should always use the same board" do
      subject.board.should be subject.board
    end

    it "s board should know its game" do
      subject.board.game.should be subject
    end

    it { should have(40).squares }

    its :squares do
      subject.all? { |s| s.should be_a FarmGame::Square }
    end

    its(:die) { should be_a FarmGame::Die }

    its(:players) { should be_a FarmGame::PlayerCollection }
    it { should have(0).players }

    describe "#play" do
      before { subject.play }

      it "should welcome the user to the game" do
        output.string.should include("Welcome")
      end

      it "should create two players" do
        subject.should have(2).players
        players = subject.players
        players[0].name.should be == '1'
        players[1].name.should be == '2'
      end

{'fraction_non_alphanumeric': 0.09784644194756555, 'fraction_numerical': 0.00749063670411985, 'mean_word_length': 2.386687797147385, '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': '1047755', 'n_tokens_mistral': 672, 'n_tokens_neox': 647, 'n_words': 205}