<commit_before>require "hangman_game_state"

RSpec.describe HangmanGameState do

  context 'initialized with word "TELEPHONE"' do
    let(:game_state){ HangmanGameState.new('TELEPHONE') }
    describe '#lives_left' do
      it 'is 9' do
        expect(game_state.lives_left).to eq(9)
      end
    end
    describe '#masked_letters' do
      it 'is an array of nil' do
        expect(game_state.masked_letters.uniq).to match_array([nil])
      end
    end
    describe '#game_won?' do
      it 'is false' do
        expect(game_state.game_won?).to eq(false)
      end
    end
    describe '#game_lost?' do
      it 'is false' do
        expect(game_state.game_lost?).to eq(false)
      end
    end
    describe '#game_over?' do
      it 'is false' do
        expect(game_state.game_over?).to eq(false)
      end
    end

    context 'with 1 correct guess' do
      let(:letters_guessed) { ['E'] }
      before do
        letters_guessed.each {|letter| game_state.guess_letter(letter)}
      end
      describe '#lives_left' do
        it 'is 9' do
          expect(game_state.lives_left).to eq(9)
        end
      end
      describe '#masked_letters' do
        it 'is an array of a mix of nil and the letter guessed' do
          expect(game_state.masked_letters.uniq).to match_array([nil] + letters_guessed)<commit_msg>feedback from roger, need to incorporate (i.e. refactor)<commit_after>require "hangman_game_state"

RSpec.describe HangmanGameState do

  context 'initialized with word "TELEPHONE"' do
    let(:game_state){ HangmanGameState.new('TELEPHONE') }

    describe "#game_lost?" do
      subject { game_state.game_lost? }

      context "at the start of the game" do
        it { is_expected.to be false }
      end

      context "after one guess" do
        let(:letters_guessed) { ["a"] }
        it { is_expected.to be false }
      end
    end

    describe '#lives_left' do
      it 'is 9' do
        expect(game_state.lives_left).to eq(9)
      end
    end
    describe '#masked_letters' do
      it 'is an array of nil' do
        expect(game_state.masked_letters.uniq).to match_array([nil])
      end
    end
    describe '#game_won?' do
      it 'is false' do
        expect(game_state.game_won?).to eq(false)
      end
    end
    describe '#game_lost?' do
      it 'is false' do
        expect(game_state.game_lost?).to eq(false)
        expect(game_state).to_not be_game_lost
      end
    end
    describe '#game_over?' do
      it 'is false' do
        expect(game_state.game_over?).to eq(false)
      end
    end

    context 'with 1 correct guess' do
      let(:letters_guessed) { ['E'] }
      before do
        letters_guessed.each {|letter| game_state.guess_letter(letter)}
      end
      describe '#lives_left' do
        it 'is 9' do
          expect(game_state.lives_left).to eq(9)
        end
      end
      describe '#masked_letters' do
        it 'is an array of a mix of nil and the letter guessed' do
          expect(game_state.masked_letters.uniq).to match_array([nil] + letters_guessed)
{'fraction_non_alphanumeric': 0.09660402242004616, 'fraction_numerical': 0.003297065611605671, 'mean_word_length': 2.4128233970753654, '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': '3807273', 'n_tokens_mistral': 1025, 'n_tokens_neox': 977, 'n_words': 271}