summaryrefslogtreecommitdiffstats
path: root/test/functional/boards_controller_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/boards_controller_test.rb')
-rw-r--r--test/functional/boards_controller_test.rb117
1 files changed, 97 insertions, 20 deletions
diff --git a/test/functional/boards_controller_test.rb b/test/functional/boards_controller_test.rb
index f395769ec..0b500249d 100644
--- a/test/functional/boards_controller_test.rb
+++ b/test/functional/boards_controller_test.rb
@@ -25,20 +25,26 @@ class BoardsControllerTest < Redmine::ControllerTest
end
def test_index
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'table.boards'
end
def test_index_not_found
- get :index, :project_id => 97
+ get :index, :params => {
+ :project_id => 97
+ }
assert_response 404
end
def test_index_should_show_messages_if_only_one_board
Project.find(1).boards.to_a.slice(1..-1).each(&:destroy)
- get :index, :project_id => 1
+ get :index, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'table.boards', 0
@@ -46,7 +52,10 @@ class BoardsControllerTest < Redmine::ControllerTest
end
def test_show
- get :show, :project_id => 1, :id => 1
+ get :show, :params => {
+ :project_id => 1,
+ :id => 1
+ }
assert_response :success
assert_select 'table.messages tbody' do
@@ -58,7 +67,10 @@ class BoardsControllerTest < Redmine::ControllerTest
Message.update_all(:sticky => 0)
Message.where({:id => 1}).update_all({:sticky => 1})
- get :show, :project_id => 1, :id => 1
+ get :show, :params => {
+ :project_id => 1,
+ :id => 1
+ }
assert_response :success
assert_select 'table.messages tbody' do
@@ -77,7 +89,10 @@ class BoardsControllerTest < Redmine::ControllerTest
reply = Message.new(:board_id => 1, :subject => 'New reply', :content => 'New reply', :author_id => 2)
old_topic.children << reply
- get :show, :project_id => 1, :id => 1
+ get :show, :params => {
+ :project_id => 1,
+ :id => 1
+ }
assert_response :success
assert_select 'table.messages tbody' do
@@ -88,7 +103,10 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_show_with_permission_should_display_the_new_message_form
@request.session[:user_id] = 2
- get :show, :project_id => 1, :id => 1
+ get :show, :params => {
+ :project_id => 1,
+ :id => 1
+ }
assert_response :success
assert_select 'form#message-form' do
@@ -97,20 +115,29 @@ class BoardsControllerTest < Redmine::ControllerTest
end
def test_show_atom
- get :show, :project_id => 1, :id => 1, :format => 'atom'
+ get :show, :params => {
+ :project_id => 1,
+ :id => 1,
+ :format => 'atom'
+ }
assert_response :success
assert_select 'feed > entry > title', :text => 'Help: RE: post 2'
end
def test_show_not_found
- get :index, :project_id => 1, :id => 97
+ get :index, :params => {
+ :project_id => 1,
+ :id => 97
+ }
assert_response 404
end
def test_new
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'board[parent_id]' do
@@ -128,7 +155,9 @@ class BoardsControllerTest < Redmine::ControllerTest
Project.find(1).boards.delete_all
@request.session[:user_id] = 2
- get :new, :project_id => 1
+ get :new, :params => {
+ :project_id => 1
+ }
assert_response :success
assert_select 'select[name=?]', 'board[parent_id]', 0
@@ -137,7 +166,13 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_create
@request.session[:user_id] = 2
assert_difference 'Board.count' do
- post :create, :project_id => 1, :board => { :name => 'Testing', :description => 'Testing board creation'}
+ post :create, :params => {
+ :project_id => 1,
+ :board => {
+ :name => 'Testing',
+ :description => 'Testing board creation'
+ }
+ }
end
assert_redirected_to '/projects/ecookbook/settings/boards'
board = Board.order('id DESC').first
@@ -148,7 +183,14 @@ class BoardsControllerTest < Redmine::ControllerTest
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}
+ post :create, :params => {
+ :project_id => 1,
+ :board => {
+ :name => 'Testing',
+ :description => 'Testing',
+ :parent_id => 2
+ }
+ }
end
assert_redirected_to '/projects/ecookbook/settings/boards'
board = Board.order('id DESC').first
@@ -158,7 +200,13 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_create_with_failure
@request.session[:user_id] = 2
assert_no_difference 'Board.count' do
- post :create, :project_id => 1, :board => { :name => '', :description => 'Testing board creation'}
+ post :create, :params => {
+ :project_id => 1,
+ :board => {
+ :name => '',
+ :description => 'Testing board creation'
+ }
+ }
end
assert_response :success
assert_select_error /Name cannot be blank/
@@ -166,7 +214,10 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_edit
@request.session[:user_id] = 2
- get :edit, :project_id => 1, :id => 2
+ get :edit, :params => {
+ :project_id => 1,
+ :id => 2
+ }
assert_response :success
assert_select 'input[name=?][value=?]', 'board[name]', 'Discussion'
end
@@ -174,7 +225,10 @@ class BoardsControllerTest < Redmine::ControllerTest
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
+ get :edit, :params => {
+ :project_id => 1,
+ :id => board.id
+ }
assert_response :success
assert_select 'select[name=?]', 'board[parent_id]' do
@@ -185,7 +239,14 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_update
@request.session[:user_id] = 2
assert_no_difference 'Board.count' do
- put :update, :project_id => 1, :id => 2, :board => { :name => 'Testing', :description => 'Testing board update'}
+ put :update, :params => {
+ :project_id => 1,
+ :id => 2,
+ :board => {
+ :name => 'Testing',
+ :description => 'Testing board update'
+ }
+ }
end
assert_redirected_to '/projects/ecookbook/settings/boards'
assert_equal 'Testing', Board.find(2).name
@@ -193,7 +254,13 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_update_position
@request.session[:user_id] = 2
- put :update, :project_id => 1, :id => 2, :board => { :position => 1}
+ put :update, :params => {
+ :project_id => 1,
+ :id => 2,
+ :board => {
+ :position => 1
+ }
+ }
assert_redirected_to '/projects/ecookbook/settings/boards'
board = Board.find(2)
assert_equal 1, board.position
@@ -201,7 +268,14 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_update_with_failure
@request.session[:user_id] = 2
- put :update, :project_id => 1, :id => 2, :board => { :name => '', :description => 'Testing board update'}
+ put :update, :params => {
+ :project_id => 1,
+ :id => 2,
+ :board => {
+ :name => '',
+ :description => 'Testing board update'
+ }
+ }
assert_response :success
assert_select_error /Name cannot be blank/
end
@@ -209,7 +283,10 @@ class BoardsControllerTest < Redmine::ControllerTest
def test_destroy
@request.session[:user_id] = 2
assert_difference 'Board.count', -1 do
- delete :destroy, :project_id => 1, :id => 2
+ delete :destroy, :params => {
+ :project_id => 1,
+ :id => 2
+ }
end
assert_redirected_to '/projects/ecookbook/settings/boards'
assert_nil Board.find_by_id(2)