summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-23 14:39:55 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-23 14:39:55 +0000
commitc49ef8e543c47ebe1a50f54811545ba21159beef (patch)
tree2863729b24ed1f5c16f4a00dd48a8ef5759b9dd6 /test/functional
parente6a64aa00bea61d24c0ba0e28ecaabcca53ee09b (diff)
downloadredmine-c49ef8e543c47ebe1a50f54811545ba21159beef.tar.gz
redmine-c49ef8e543c47ebe1a50f54811545ba21159beef.zip
Adds functional tests.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8948 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/attachments_controller_test.rb5
-rw-r--r--test/functional/issue_categories_controller_test.rb24
-rw-r--r--test/functional/issue_statuses_controller_test.rb14
3 files changed, 43 insertions, 0 deletions
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index 834e6b08b..4deae88c8 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -219,6 +219,11 @@ class AttachmentsControllerTest < ActionController::TestCase
assert_response 403
end
+ def test_show_invalid_should_respond_with_404
+ get :show, :id => 999
+ assert_response 404
+ end
+
def test_download_text_file
get :download, :id => 4
assert_response :success
diff --git a/test/functional/issue_categories_controller_test.rb b/test/functional/issue_categories_controller_test.rb
index 221d5d1cc..15bee0ccd 100644
--- a/test/functional/issue_categories_controller_test.rb
+++ b/test/functional/issue_categories_controller_test.rb
@@ -57,6 +57,30 @@ class IssueCategoriesControllerTest < ActionController::TestCase
assert_template 'new'
end
+ def test_create_from_issue_form
+ @request.session[:user_id] = 2 # manager
+ assert_difference 'IssueCategory.count' do
+ xhr :post, :create, :project_id => '1', :issue_category => {:name => 'New category'}
+ end
+ category = IssueCategory.first(:order => 'id DESC')
+ assert_equal 'New category', category.name
+
+ assert_response :success
+ assert_select_rjs :replace, 'issue_category_id' do
+ assert_select "option[value=#{category.id}][selected=selected]"
+ end
+ end
+
+ def test_create_from_issue_form_with_failure
+ @request.session[:user_id] = 2 # manager
+ assert_no_difference 'IssueCategory.count' do
+ xhr :post, :create, :project_id => '1', :issue_category => {:name => ''}
+ end
+
+ assert_response :success
+ assert_match /alert/, @response.body
+ end
+
def test_edit
@request.session[:user_id] = 2
get :edit, :id => 2
diff --git a/test/functional/issue_statuses_controller_test.rb b/test/functional/issue_statuses_controller_test.rb
index 33519de61..c32999f80 100644
--- a/test/functional/issue_statuses_controller_test.rb
+++ b/test/functional/issue_statuses_controller_test.rb
@@ -49,6 +49,13 @@ class IssueStatusesControllerTest < ActionController::TestCase
assert_equal 'New status', status.name
end
+ def test_create_with_failure
+ post :create, :issue_status => {:name => ''}
+ assert_response :success
+ assert_template 'new'
+ assert_error_tag :content => /name can't be blank/i
+ end
+
def test_edit
get :edit, :id => '3'
assert_response :success
@@ -62,6 +69,13 @@ class IssueStatusesControllerTest < ActionController::TestCase
assert_equal 'Renamed status', status.name
end
+ def test_update_with_failure
+ put :update, :id => '3', :issue_status => {:name => ''}
+ assert_response :success
+ assert_template 'edit'
+ assert_error_tag :content => /name can't be blank/i
+ end
+
def test_destroy
Issue.delete_all("status_id = 1")