Sha256: f043b15ab242154552f4b802be546edbb8de0198c3e59bc89e47c4c015b54d69

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 Bytes

Contents

require 'minitest/autorun'
require 'pirate_game'

class TestPirateGameLogBook < MiniTest::Unit::TestCase

  def setup
    @log_book = PirateGame::LogBook.new
  end

  def test_initialize
    assert_empty @log_book
  end

  def test_add
    @log_book.add 'Day One', 'Davy'

    assert_equal 1, @log_book.length
    assert_equal ['Day One', 'Davy'], @log_book.first
  end

  def test_maintain_size
    10.times do |i|
      @log_book.add "Day #{i+1}", 'Davy'
    end

    assert_equal 10, @log_book.length

    @log_book.add "Another Day", 'Eric'

    assert_equal 10, @log_book.length
    assert_equal ['Day 2', 'Davy'], @log_book.first
    assert @log_book.detect{|msg,auth| auth == 'Eric'}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pirate_game-0.0.1 test/test_pirate_game_log_book.rb