annotate test/unit/board_test.rb @ 1082:997f6d7738f7
bug_531
In repo controller entry action, show the page for the file even if it's binary (so user still has access to history etc links). This makes it possible to use the entry action as the default when a file is clicked on
author |
Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
date |
Thu, 22 Nov 2012 18:04:17 +0000 |
parents |
cbb26bc654de |
children |
433d4f72a19b |
rev |
line source |
Chris@119
|
1 require File.expand_path('../../test_helper', __FILE__)
|
Chris@0
|
2
|
Chris@0
|
3 class BoardTest < ActiveSupport::TestCase
|
Chris@119
|
4 fixtures :projects, :boards, :messages, :attachments, :watchers
|
Chris@0
|
5
|
Chris@0
|
6 def setup
|
Chris@0
|
7 @project = Project.find(1)
|
Chris@0
|
8 end
|
Chris@909
|
9
|
Chris@0
|
10 def test_create
|
Chris@0
|
11 board = Board.new(:project => @project, :name => 'Test board', :description => 'Test board description')
|
Chris@0
|
12 assert board.save
|
Chris@0
|
13 board.reload
|
Chris@0
|
14 assert_equal 'Test board', board.name
|
Chris@0
|
15 assert_equal 'Test board description', board.description
|
Chris@0
|
16 assert_equal @project, board.project
|
Chris@0
|
17 assert_equal 0, board.topics_count
|
Chris@0
|
18 assert_equal 0, board.messages_count
|
Chris@0
|
19 assert_nil board.last_message
|
Chris@0
|
20 # last position
|
Chris@0
|
21 assert_equal @project.boards.size, board.position
|
Chris@0
|
22 end
|
Chris@909
|
23
|
Chris@0
|
24 def test_destroy
|
Chris@0
|
25 board = Board.find(1)
|
Chris@119
|
26 assert_difference 'Message.count', -6 do
|
Chris@119
|
27 assert_difference 'Attachment.count', -1 do
|
Chris@119
|
28 assert_difference 'Watcher.count', -1 do
|
Chris@119
|
29 assert board.destroy
|
Chris@119
|
30 end
|
Chris@119
|
31 end
|
Chris@119
|
32 end
|
Chris@0
|
33 assert_equal 0, Message.count(:conditions => {:board_id => 1})
|
Chris@0
|
34 end
|
Chris@0
|
35 end
|