summaryrefslogtreecommitdiffstats
path: root/test/functional/projects_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-23 14:18:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-23 14:18:54 +0000
commit0f721f6f7bd192145acddaaea2ca2787eab75e09 (patch)
tree70864eb6fa66e5658452a2c5ced920ce0f1a132e /test/functional/projects_controller_test.rb
parent8f24aa6c676b90f125adc9bf75ecc1cbdaf7a379 (diff)
downloadredmine-0f721f6f7bd192145acddaaea2ca2787eab75e09.tar.gz
redmine-0f721f6f7bd192145acddaaea2ca2787eab75e09.zip
Adds functional tests.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8945 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/projects_controller_test.rb')
-rw-r--r--test/functional/projects_controller_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index 4888e42a2..6a788e6ec 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -395,6 +395,14 @@ class ProjectsControllerTest < ActionController::TestCase
assert_equal 'Test changed name', project.name
end
+ def test_update_with_failure
+ @request.session[:user_id] = 2 # manager
+ post :update, :id => 1, :project => {:name => ''}
+ assert_response :success
+ assert_template 'settings'
+ assert_error_tag :content => /name can't be blank/i
+ end
+
def test_modules
@request.session[:user_id] = 2
Project.find(1).enabled_module_names = ['issue_tracking', 'news']
@@ -432,6 +440,14 @@ class ProjectsControllerTest < ActionController::TestCase
assert !Project.find(1).active?
end
+ def test_archive_with_failure
+ @request.session[:user_id] = 1
+ Project.any_instance.stubs(:archive).returns(false)
+ post :archive, :id => 1
+ assert_redirected_to '/admin/projects'
+ assert_match /project cannot be archived/i, flash[:error]
+ end
+
def test_unarchive
@request.session[:user_id] = 1 # admin
Project.find(1).archive