<commit_before>require 'rspec'
require 'world.rb'

describe 'World'  do

  describe '#set_cell_status' do

    let(:world) { World.new }

    context 'when the cell is alive' do

      it 'sets status to dead if cell has less than two live neighbours' do
        world.set_initial_live_cells([10,9])
        world.set_cell_status(world.grid[10])

        expect(world.grid[10].status).to eq(:dead)
      end

      it 'sets status to dead if cell has more than three live neighbours' do
        world.set_initial_live_cells([10,9,11,0,20])
        world.set_cell_status(world.grid[10])

        expect(world.grid[10].status).to eq(:dead)
      end

      it 'continues to live if it has two or three live neighbours' do
        world.set_initial_live_cells([10,9,11])
        world.set_cell_status(world.grid[10])

        expect(world.grid[10].status).to eq(:alive)
      end
    end

    context 'when the cell is dead' do

      it 'comes to life if it has exactly three live neighbours'do
        world.set_initial_live_cells([9,11,0])
        world.set_cell_status(world.grid[10])

        expect(world.grid[10].status).to eq(:alive)

      end
    end

  end


end<commit_msg>Complete the specs for public API of the World class<commit_after>require 'rspec'
require 'world.rb'

describe 'World'  do

  let(:world) { World.new }
  let(:grid) { world.grid }

  describe '#set_initial_live_cells' do

    it 'sets the status of the cells, on the given positions, to alive' do
      cell_positions = [94]
      world.set_initial_live_cells(cell_positions)

      expect(grid[94].status).to eq(:alive)
    end
  end

  describe '#set_cell_status' do

    context 'when the cell is alive' do

      it 'sets status to dead if cell has less than two live neighbours' do
        cell_positions = [10, 9]
        world.set_initial_live_cells(cell_positions)

        world.set_cell_status(grid[10])
        expect(grid[10].status).to eq(:dead)
      end

      it 'sets status to dead if cell has more than three live neighbours' do
        cell_positions = [10,9,11,0,20]
        world.set_initial_live_cells(cell_positions)

        world.set_cell_status(grid[10])
        expect(grid[10].status).to eq(:dead)
      end

      it 'lets the status to be alive if it has two or three live neighbours' do
        cell_positions = [10,9,11,0]
        world.set_initial_live_cells(cell_positions)

        world.set_cell_status(grid[10])
        expect(grid[10].status).to eq(:alive)
      end
    end

    context 'when the cell is dead' do

      it 'sets status to alive if it has exactly three live neighbours'do
        cell_positions = [9,11,0]
        world.set_initial_live_cells(cell_positions)

        world.set_cell_status(grid[10])
        expect(grid[10].status).to eq(:alive)

      end
    end

  end

end
{'fraction_non_alphanumeric': 0.09698046181172292, 'fraction_numerical': 0.027353463587921848, 'mean_word_length': 2.774798927613941, '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': '3904055', 'n_tokens_mistral': 978, 'n_tokens_neox': 881, 'n_words': 251}