@@ -1,35 +1,35 | |||
|
1 | 1 | require File.expand_path('../../test_helper', __FILE__) |
|
2 | 2 | |
|
3 | 3 | class BoardTest < ActiveSupport::TestCase |
|
4 | 4 | fixtures :projects, :boards, :messages, :attachments, :watchers |
|
5 | 5 | |
|
6 | 6 | def setup |
|
7 | 7 | @project = Project.find(1) |
|
8 | 8 | end |
|
9 | ||
|
9 | ||
|
10 | 10 | def test_create |
|
11 | 11 | board = Board.new(:project => @project, :name => 'Test board', :description => 'Test board description') |
|
12 | 12 | assert board.save |
|
13 | 13 | board.reload |
|
14 | 14 | assert_equal 'Test board', board.name |
|
15 | 15 | assert_equal 'Test board description', board.description |
|
16 | 16 | assert_equal @project, board.project |
|
17 | 17 | assert_equal 0, board.topics_count |
|
18 | 18 | assert_equal 0, board.messages_count |
|
19 | 19 | assert_nil board.last_message |
|
20 | 20 | # last position |
|
21 | 21 | assert_equal @project.boards.size, board.position |
|
22 | 22 | end |
|
23 | ||
|
23 | ||
|
24 | 24 | def test_destroy |
|
25 | 25 | board = Board.find(1) |
|
26 | 26 | assert_difference 'Message.count', -6 do |
|
27 | 27 | assert_difference 'Attachment.count', -1 do |
|
28 | 28 | assert_difference 'Watcher.count', -1 do |
|
29 | 29 | assert board.destroy |
|
30 | 30 | end |
|
31 | 31 | end |
|
32 | 32 | end |
|
33 | 33 | assert_equal 0, Message.count(:conditions => {:board_id => 1}) |
|
34 | 34 | end |
|
35 | 35 | end |
General Comments 0
You need to be logged in to leave comments.
Login now