<commit_before>require "spec_helper"

module TicTacToe
  describe Game do

    let (:kiy) {Player.new({marker: "x", name: "kiy"})}
    let (:cpu) {Player.new({marker: "o", name: "cpu"})}
    
    context "#initialze" do
      it "should randomly select a current player" do
        Array.any_instance.stub(:shuffle) {[kiy, cpu]}
        game = Game.new([kiy, cpu])
        expect(game.current_player).to eq kiy
      end

      it "should randomly select another player" do
        Array.any_instance.stub(:shuffle) {[kiy, cpu]}
        game = Game.new([kiy, cpu])
        expect(game.other_player).to eq cpu  
      end
    end

    context "#switch_players" do
      it "should set @current_player to @other_player" do
        game = Game.new([kiy, cpu])
        other_player = game.other_player
        game.switch_players
        expect(game.current_player). to eq other_player     
      end
    end
  end
end

<commit_msg>Added further test to method switch_players<commit_after>require "spec_helper"

module TicTacToe
  describe Game do

    let (:kiy) {Player.new({marker: "x", name: "kiy"})}
    let (:cpu) {Player.new({marker: "o", name: "cpu"})}
    
    context "#initialze" do
      it "should randomly select a current player" do
        Array.any_instance.stub(:shuffle) {[kiy, cpu]}
        game = Game.new([kiy, cpu])
        expect(game.current_player).to eq kiy
      end

      it "should randomly select another player" do
        Array.any_instance.stub(:shuffle) {[kiy, cpu]}
        game = Game.new([kiy, cpu])
        expect(game.other_player).to eq cpu  
      end
    end

    context "#switch_players" do
      it "should set @current_player to @other_player" do
        game = Game.new([kiy, cpu])
        other_player = game.other_player
        game.switch_players
        expect(game.current_player).to eq other_player     
      end

      it "should set @other_player to @current_player " do
        game = Game.new([kiy, cpu])
        current_player = game.current_player
        game.switch_players
        expect(game.other_player).to eq current_player
      end
    end
  end
end


{'fraction_non_alphanumeric': 0.11137328928739972, 'fraction_numerical': 0.0, 'mean_word_length': 2.51575456053068, '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': '870679', 'n_tokens_mistral': 683, 'n_tokens_neox': 674, 'n_words': 185}