Source

tdd_ios_kiwi / source / sample_doc_fragments.txt

.. code-block:: ruby
  :linenos: 
  
  require 'test/unit'
  $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
  require "tic-tac-toe/board"
  
  class BoardTest < Test::Unit::TestCase
    def test_board_create
      board = TicTacToe::Board.new 
      assert_not_nil(board, "Failed to create board")
      assert_equals board.size, 9 
    end
  end 

.. note::

  I know line 2 looks like a nightmare, but it's kind of simple, I am getting the directory name(dirname) of the current file("test/board_test.rb")
  adding the ../lib to that path string.  Then it expands that string it creates a full absolute path string and the "<<" means to 
  push that string on top of the load path.  this way it can find the location of the classes we write for the test



.. code-block:: bash
  
  $ ruby test/board_test.rb
  
.. image:: images/ttt_uml.png

..literalinclude:: filename
    :linenos:
    :language:objective-c    
    :lines:1, 3-5
    :start-after:3     
    :end-before: 5