You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

board_test.rb 896B

123456789101112131415161718192021222324252627282930
  1. require File.dirname(__FILE__) + '/../test_helper'
  2. class BoardTest < Test::Unit::TestCase
  3. fixtures :projects, :boards, :messages
  4. def setup
  5. @project = Project.find(1)
  6. end
  7. def test_create
  8. board = Board.new(:project => @project, :name => 'Test board', :description => 'Test board description')
  9. assert board.save
  10. board.reload
  11. assert_equal 'Test board', board.name
  12. assert_equal 'Test board description', board.description
  13. assert_equal @project, board.project
  14. assert_equal 0, board.topics_count
  15. assert_equal 0, board.messages_count
  16. assert_nil board.last_message
  17. # last position
  18. assert_equal @project.boards.size, board.position
  19. end
  20. def test_destroy
  21. board = Board.find(1)
  22. assert board.destroy
  23. # make sure that the associated messages are removed
  24. assert_equal 0, Message.count(:conditions => {:board_id => 1})
  25. end
  26. end