diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-12-14 17:31:24 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-12-14 17:31:24 +0000 |
commit | eb7cbd481e44fcb636957acc7896aefa52743f70 (patch) | |
tree | 970e94406e35111aa26adf010060436632181c73 /test/functional | |
parent | 17c7886791a7dd33daaa8ed0e334f733afefc4a1 (diff) | |
download | redmine-eb7cbd481e44fcb636957acc7896aefa52743f70.tar.gz redmine-eb7cbd481e44fcb636957acc7896aefa52743f70.zip |
Added some tests for projects controller and helper.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@989 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/projects_controller_test.rb | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 52c33ddd7..b6ac59141 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -52,7 +52,37 @@ class ProjectsControllerTest < Test::Unit::TestCase assert_response :success assert_template 'show'
assert_not_nil assigns(:project)
+ end + + def test_settings + @request.session[:user_id] = 2 # manager + get :settings, :id => 1 + assert_response :success + assert_template 'settings' + end + + def test_edit + @request.session[:user_id] = 2 # manager + post :edit, :id => 1, :project => {:name => 'Test changed name'} + assert_redirected_to 'projects/settings/1' + project = Project.find(1) + assert_equal 'Test changed name', project.name + end + + def test_get_destroy + @request.session[:user_id] = 1 # admin + get :destroy, :id => 1 + assert_response :success + assert_template 'destroy' + assert_not_nil Project.find_by_id(1) end
+ + def test_post_destroy + @request.session[:user_id] = 1 # admin + post :destroy, :id => 1, :confirm => 1 + assert_redirected_to 'admin/projects' + assert_nil Project.find_by_id(1) + end def test_list_documents
get :list_documents, :id => 1
@@ -70,7 +100,23 @@ class ProjectsControllerTest < Test::Unit::TestCase assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id} assert_equal 'Bulk editing', Issue.find(1).journals.find(:first, :order => 'created_on DESC').notes end
-
+ + def test_move_issues_to_another_project + @request.session[:user_id] = 1 + post :move_issues, :id => 1, :issue_ids => [1, 2], :new_project_id => 2 + assert_redirected_to 'projects/1/issues' + assert_equal 2, Issue.find(1).project_id + assert_equal 2, Issue.find(2).project_id + end + + def test_move_issues_to_another_tracker + @request.session[:user_id] = 1 + post :move_issues, :id => 1, :issue_ids => [1, 2], :new_tracker_id => 3 + assert_redirected_to 'projects/1/issues' + assert_equal 3, Issue.find(1).tracker_id + assert_equal 3, Issue.find(2).tracker_id + end +
def test_list_files
get :list_files, :id => 1
assert_response :success
|