summaryrefslogtreecommitdiffstats
path: root/test/functional/boards_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-31 17:17:52 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-31 17:17:52 +0000
commitbc153cb61df37e2097c5bec529cabdb15e6887bf (patch)
tree05be0525dc3258c00349e7cc6b5ab333ca4139c0 /test/functional/boards_controller_test.rb
parent9554f0133ff634264eb110c91ad317be28e6dd32 (diff)
downloadredmine-bc153cb61df37e2097c5bec529cabdb15e6887bf.tar.gz
redmine-bc153cb61df37e2097c5bec529cabdb15e6887bf.zip
Support for subforums (#3831).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10142 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/boards_controller_test.rb')
-rw-r--r--test/functional/boards_controller_test.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/functional/boards_controller_test.rb b/test/functional/boards_controller_test.rb
index 1c4ac67d4..8afe4f748 100644
--- a/test/functional/boards_controller_test.rb
+++ b/test/functional/boards_controller_test.rb
@@ -98,6 +98,23 @@ class BoardsControllerTest < ActionController::TestCase
get :new, :project_id => 1
assert_response :success
assert_template 'new'
+
+ assert_select 'select[name=?]', 'board[parent_id]' do
+ assert_select 'option', (Project.find(1).boards.size + 1)
+ assert_select 'option[value=]', :text => ''
+ assert_select 'option[value=1]', :text => 'Help'
+ end
+ end
+
+ def test_new_without_project_boards
+ Project.find(1).boards.delete_all
+ @request.session[:user_id] = 2
+
+ get :new, :project_id => 1
+ assert_response :success
+ assert_template 'new'
+
+ assert_select 'select[name=?]', 'board[parent_id]', 0
end
def test_create
@@ -111,6 +128,16 @@ class BoardsControllerTest < ActionController::TestCase
assert_equal 'Testing board creation', board.description
end
+ def test_create_with_parent
+ @request.session[:user_id] = 2
+ assert_difference 'Board.count' do
+ post :create, :project_id => 1, :board => { :name => 'Testing', :description => 'Testing', :parent_id => 2}
+ end
+ assert_redirected_to '/projects/ecookbook/settings/boards'
+ board = Board.first(:order => 'id DESC')
+ assert_equal Board.find(2), board.parent
+ end
+
def test_create_with_failure
@request.session[:user_id] = 2
assert_no_difference 'Board.count' do
@@ -127,6 +154,18 @@ class BoardsControllerTest < ActionController::TestCase
assert_template 'edit'
end
+ def test_edit_with_parent
+ board = Board.generate!(:project_id => 1, :parent_id => 2)
+ @request.session[:user_id] = 2
+ get :edit, :project_id => 1, :id => board.id
+ assert_response :success
+ assert_template 'edit'
+
+ assert_select 'select[name=?]', 'board[parent_id]' do
+ assert_select 'option[value=2][selected=selected]'
+ end
+ end
+
def test_update
@request.session[:user_id] = 2
assert_no_difference 'Board.count' do