To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / test / unit / .svn / text-base / board_test.rb.svn-base @ 442:753f1380d6bc

History | View | Annotate | Download (1.03 KB)

1
require File.expand_path('../../test_helper', __FILE__)
2

    
3
class BoardTest < ActiveSupport::TestCase
4
  fixtures :projects, :boards, :messages, :attachments, :watchers
5

    
6
  def setup
7
    @project = Project.find(1)
8
  end
9
  
10
  def test_create
11
    board = Board.new(:project => @project, :name => 'Test board', :description => 'Test board description')
12
    assert board.save
13
    board.reload
14
    assert_equal 'Test board', board.name
15
    assert_equal 'Test board description', board.description
16
    assert_equal @project, board.project
17
    assert_equal 0, board.topics_count
18
    assert_equal 0, board.messages_count
19
    assert_nil board.last_message
20
    # last position
21
    assert_equal @project.boards.size, board.position
22
  end
23
  
24
  def test_destroy
25
    board = Board.find(1)
26
    assert_difference 'Message.count', -6 do
27
      assert_difference 'Attachment.count', -1 do
28
        assert_difference 'Watcher.count', -1 do
29
          assert board.destroy
30
        end
31
      end
32
    end
33
    assert_equal 0, Message.count(:conditions => {:board_id => 1})
34
  end
35
end