summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-05-18 05:56:55 +0000
committerGo MAEDA <maeda@farend.jp>2024-05-18 05:56:55 +0000
commita9518e28b86a330cbbc2cd2c9170e1cd38c458e2 (patch)
tree0a89a098bd85c03c1eeadfd29beb72683afa30a1 /test/functional
parent58e9cd420adad1802d42828c8efedca0e6fed2d1 (diff)
downloadredmine-a9518e28b86a330cbbc2cd2c9170e1cd38c458e2.tar.gz
redmine-a9518e28b86a330cbbc2cd2c9170e1cd38c458e2.zip
Fix RuboCop offense Rails/HttpStatus (#39889).
git-svn-id: https://svn.redmine.org/redmine/trunk@22837 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/account_controller_test.rb8
-rw-r--r--test/functional/activities_controller_test.rb6
-rw-r--r--test/functional/attachments_controller_test.rb44
-rw-r--r--test/functional/attachments_visibility_test.rb2
-rw-r--r--test/functional/auth_sources_controller_test.rb4
-rw-r--r--test/functional/boards_controller_test.rb4
-rw-r--r--test/functional/comments_controller_test.rb2
-rw-r--r--test/functional/context_menus_controller_test.rb4
-rw-r--r--test/functional/custom_field_enumerations_controller_test.rb4
-rw-r--r--test/functional/custom_fields_controller_test.rb6
-rw-r--r--test/functional/email_addresses_controller_test.rb16
-rw-r--r--test/functional/enumerations_controller_test.rb10
-rw-r--r--test/functional/groups_controller_test.rb4
-rw-r--r--test/functional/imports_controller_test.rb12
-rw-r--r--test/functional/issue_categories_controller_test.rb2
-rw-r--r--test/functional/issue_relations_controller_test.rb4
-rw-r--r--test/functional/issue_statuses_controller_test.rb2
-rw-r--r--test/functional/issues_controller_test.rb98
-rw-r--r--test/functional/issues_controller_transaction_test.rb8
-rw-r--r--test/functional/issues_custom_fields_visibility_test.rb6
-rw-r--r--test/functional/journals_controller_test.rb10
-rw-r--r--test/functional/mail_handler_controller_test.rb12
-rw-r--r--test/functional/members_controller_test.rb2
-rw-r--r--test/functional/messages_controller_test.rb8
-rw-r--r--test/functional/my_controller_test.rb2
-rw-r--r--test/functional/news_controller_test.rb8
-rw-r--r--test/functional/projects_controller_test.rb26
-rw-r--r--test/functional/queries_controller_test.rb24
-rw-r--r--test/functional/reports_controller_test.rb2
-rw-r--r--test/functional/repositories_bazaar_controller_test.rb4
-rw-r--r--test/functional/repositories_controller_test.rb10
-rw-r--r--test/functional/repositories_cvs_controller_test.rb4
-rw-r--r--test/functional/repositories_filesystem_controller_test.rb4
-rw-r--r--test/functional/repositories_git_controller_test.rb10
-rw-r--r--test/functional/repositories_mercurial_controller_test.rb8
-rw-r--r--test/functional/repositories_subversion_controller_test.rb10
-rw-r--r--test/functional/roles_controller_test.rb4
-rw-r--r--test/functional/search_controller_test.rb8
-rw-r--r--test/functional/settings_controller_test.rb6
-rw-r--r--test/functional/sys_controller_test.rb6
-rw-r--r--test/functional/timelog_controller_test.rb26
-rw-r--r--test/functional/trackers_controller_test.rb2
-rw-r--r--test/functional/users_controller_test.rb26
-rw-r--r--test/functional/watchers_controller_test.rb12
-rw-r--r--test/functional/welcome_controller_test.rb4
-rw-r--r--test/functional/wiki_controller_test.rb28
-rw-r--r--test/functional/wikis_controller_test.rb2
-rw-r--r--test/functional/workflows_controller_test.rb18
48 files changed, 266 insertions, 266 deletions
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb
index 1bf1bb1bb..083b2bafd 100644
--- a/test/functional/account_controller_test.rb
+++ b/test/functional/account_controller_test.rb
@@ -230,7 +230,7 @@ class AccountControllerTest < Redmine::ControllerTest
:password => 'jsmith'
}
)
- assert_response 500
+ assert_response :internal_server_error
assert_select_error /Something wrong/
end
@@ -243,7 +243,7 @@ class AccountControllerTest < Redmine::ControllerTest
:password => 'jsmith'
}
)
- assert_response 302
+ assert_response :found
end
def test_login_should_strip_whitespaces_from_user_name
@@ -254,7 +254,7 @@ class AccountControllerTest < Redmine::ControllerTest
:password => 'jsmith'
}
)
- assert_response 302
+ assert_response :found
assert_equal 2, @request.session[:user_id]
end
@@ -283,7 +283,7 @@ class AccountControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
post :logout
- assert_response 302
+ assert_response :found
end
def test_get_register_with_registration_on
diff --git a/test/functional/activities_controller_test.rb b/test/functional/activities_controller_test.rb
index 20f0b123d..3fb0c1fbc 100644
--- a/test/functional/activities_controller_test.rb
+++ b/test/functional/activities_controller_test.rb
@@ -74,7 +74,7 @@ class ActivitiesControllerTest < Redmine::ControllerTest
def test_project_index_with_invalid_project_id_should_respond_404
get(:index, :params => {:id => 299})
- assert_response 404
+ assert_response :not_found
end
def test_previous_project_index
@@ -131,7 +131,7 @@ class ActivitiesControllerTest < Redmine::ControllerTest
:user_id => 299
}
)
- assert_response 404
+ assert_response :not_found
end
def test_user_index_with_non_visible_user_id_should_respond_404
@@ -143,7 +143,7 @@ class ActivitiesControllerTest < Redmine::ControllerTest
:user_id => user.id
}
- assert_response 404
+ assert_response :not_found
end
def test_index_atom_feed
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index 7fd72ae52..2af340f6d 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -267,7 +267,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
attachment = Attachment.create!(:file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 2)
@request.session[:user_id] = 2
get(:show, :params => {:id => attachment.id})
- assert_response 200
+ assert_response :ok
end
def test_show_file_without_container_should_be_denied_to_other_users
@@ -276,7 +276,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 3
get(:show, :params => {:id => attachment.id})
- assert_response 403
+ assert_response :forbidden
end
def test_show_issue_attachment_should_highlight_issues_menu_item
@@ -287,7 +287,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
def test_show_invalid_should_respond_with_404
get(:show, :params => {:id => 999})
- assert_response 404
+ assert_response :not_found
end
def test_show_renders_pagination
@@ -307,7 +307,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
@request.env["HTTP_IF_NONE_MATCH"] = etag
get(:download, :params => {:id => 4})
- assert_response 304
+ assert_response :not_modified
end
def test_download_js_file
@@ -352,7 +352,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
def test_download_missing_file
get(:download, :params => {:id => 2})
- assert_response 404
+ assert_response :not_found
end
def test_download_should_be_denied_without_permission
@@ -383,7 +383,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:id => 16
}
)
- assert_response 304
+ assert_response :not_modified
end
def test_thumbnail_should_not_exceed_maximum_size
@@ -418,7 +418,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:id => 15
}
)
- assert_response 404
+ assert_response :not_found
end
def test_thumbnail_should_return_404_if_thumbnail_generation_failed
@@ -430,7 +430,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:id => 16
}
)
- assert_response 404
+ assert_response :not_found
end
def test_thumbnail_should_be_denied_without_permission
@@ -499,7 +499,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:object_id => '999'
}
)
- assert_response 404
+ assert_response :not_found
end
def test_edit_all_for_object_that_is_not_visible_should_return_403
@@ -510,7 +510,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:object_id => '4'
}
)
- assert_response 403
+ assert_response :forbidden
end
def test_edit_all_issue_attachment_by_user_without_edit_issue_permission_on_tracker_should_return_404
@@ -527,7 +527,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:object_id => '4'
}
)
- assert_response 404
+ assert_response :not_found
end
def test_update_all
@@ -549,7 +549,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
attachment = Attachment.find(4)
assert_equal 'newname.rb', attachment.filename
assert_equal 'Renamed', attachment.description
@@ -592,7 +592,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:object_id => '2'
}
)
- assert_response 200
+ assert_response :ok
assert_equal response.headers['Content-Type'], 'application/zip'
assert_match /issue-2-attachments.zip/, response.headers['Content-Disposition']
assert_not_includes Dir.entries(Rails.root.join('tmp')), /attachments_zip/
@@ -607,7 +607,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:object_id => '999'
}
)
- assert_response 404
+ assert_response :not_found
end
def test_download_all_without_readable_attachments
@@ -620,7 +620,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
}
)
assert_equal Issue.find(1).attachments, []
- assert_response 404
+ assert_response :not_found
end
def test_download_all_with_invisible_journal
@@ -636,7 +636,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:object_id => '3'
}
)
- assert_response 403
+ assert_response :forbidden
end
def test_download_all_with_maximum_bulk_download_size_larger_than_attachments
@@ -705,7 +705,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:id => 3
}
)
- assert_response 302
+ assert_response :found
end
end
@@ -719,7 +719,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:id => 8
}
)
- assert_response 302
+ assert_response :found
end
end
@@ -733,7 +733,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:id => 9
}
)
- assert_response 302
+ assert_response :found
end
end
@@ -748,7 +748,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
:id => 9
}
)
- assert_response 302
+ assert_response :found
end
end
@@ -762,7 +762,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
}
)
end
- assert_response 302
+ assert_response :found
assert Attachment.find_by_id(3)
end
@@ -783,7 +783,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
)
end
- assert_response 403
+ assert_response :forbidden
assert Attachment.find_by_id(7)
end
end
diff --git a/test/functional/attachments_visibility_test.rb b/test/functional/attachments_visibility_test.rb
index e9692dfcb..ad1d83f93 100644
--- a/test/functional/attachments_visibility_test.rb
+++ b/test/functional/attachments_visibility_test.rb
@@ -55,6 +55,6 @@ class AttachmentsVisibilityTest < Redmine::ControllerTest
@field.update!(:visible => false, :role_ids => [1])
get :show, :params => {:id => @attachment.id}
- assert_response 403
+ assert_response :forbidden
end
end
diff --git a/test/functional/auth_sources_controller_test.rb b/test/functional/auth_sources_controller_test.rb
index 7fdd2f376..e470e8e1b 100644
--- a/test/functional/auth_sources_controller_test.rb
+++ b/test/functional/auth_sources_controller_test.rb
@@ -48,7 +48,7 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
:type => 'foo'
}
)
- assert_response 404
+ assert_response :not_found
end
def test_create
@@ -129,7 +129,7 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
:id => 99
}
)
- assert_response 404
+ assert_response :not_found
end
def test_update
diff --git a/test/functional/boards_controller_test.rb b/test/functional/boards_controller_test.rb
index e6fbf5c8d..4062c3fb8 100644
--- a/test/functional/boards_controller_test.rb
+++ b/test/functional/boards_controller_test.rb
@@ -44,7 +44,7 @@ class BoardsControllerTest < Redmine::ControllerTest
:project_id => 97
}
)
- assert_response 404
+ assert_response :not_found
end
def test_index_should_show_messages_if_only_one_board
@@ -159,7 +159,7 @@ class BoardsControllerTest < Redmine::ControllerTest
:id => 97
}
)
- assert_response 404
+ assert_response :not_found
end
def test_new
diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb
index bd25a2673..e1118f77e 100644
--- a/test/functional/comments_controller_test.rb
+++ b/test/functional/comments_controller_test.rb
@@ -75,7 +75,7 @@ class CommentsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 403
+ assert_response :forbidden
end
end
diff --git a/test/functional/context_menus_controller_test.rb b/test/functional/context_menus_controller_test.rb
index ed3d40c45..c8d4f798d 100644
--- a/test/functional/context_menus_controller_test.rb
+++ b/test/functional/context_menus_controller_test.rb
@@ -384,12 +384,12 @@ class ContextMenusControllerTest < Redmine::ControllerTest
:ids => [1, 4] # issue 4 is not visible
}
)
- assert_response 302
+ assert_response :found
end
def test_should_respond_with_404_without_ids
get :issues
- assert_response 404
+ assert_response :not_found
end
def test_time_entries_context_menu
diff --git a/test/functional/custom_field_enumerations_controller_test.rb b/test/functional/custom_field_enumerations_controller_test.rb
index a43187786..e74790495 100644
--- a/test/functional/custom_field_enumerations_controller_test.rb
+++ b/test/functional/custom_field_enumerations_controller_test.rb
@@ -101,7 +101,7 @@ class CustomFieldEnumerationsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
@bar.reload
assert_equal "Baz", @bar.name
@@ -164,7 +164,7 @@ class CustomFieldEnumerationsControllerTest < Redmine::ControllerTest
:reassign_to_id => @bar.id
}
)
- assert_response 302
+ assert_response :found
end
assert_equal @bar.id.to_s, group.reload.custom_field_value(@field)
diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb
index 9ccb7acb8..b3fa614ba 100644
--- a/test/functional/custom_fields_controller_test.rb
+++ b/test/functional/custom_fields_controller_test.rb
@@ -445,7 +445,7 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
field = IssueCustomField.order("id desc").first
assert_equal [1, 3], field.projects.map(&:id).sort
@@ -514,7 +514,7 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
:custom_field => {:name => 'Copy'}
}
)
- assert_response 302
+ assert_response :found
end
field = IssueCustomField.order('id desc').first
assert_equal 'Copy', field.name
@@ -540,7 +540,7 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
:id => 99
}
)
- assert_response 404
+ assert_response :not_found
end
def test_update
diff --git a/test/functional/email_addresses_controller_test.rb b/test/functional/email_addresses_controller_test.rb
index 2468676b6..426547907 100644
--- a/test/functional/email_addresses_controller_test.rb
+++ b/test/functional/email_addresses_controller_test.rb
@@ -59,7 +59,7 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
def test_index_by_another_user_should_be_denied
@request.session[:user_id] = 3
get(:index, :params => {:user_id => 2})
- assert_response 403
+ assert_response :forbidden
end
def test_create
@@ -74,7 +74,7 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_redirected_to '/users/2/email_addresses'
end
email = EmailAddress.order('id DESC').first
@@ -95,7 +95,7 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
},
:xhr => true
)
- assert_response 200
+ assert_response :ok
end
end
@@ -188,7 +188,7 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
:notify => '0'
}
)
- assert_response 302
+ assert_response :found
assert_equal false, email.reload.notify
end
@@ -206,7 +206,7 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
},
:xhr => true
)
- assert_response 200
+ assert_response :ok
assert_equal false, email.reload.notify
end
@@ -245,7 +245,7 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
:id => email.id
}
)
- assert_response 302
+ assert_response :found
assert_redirected_to '/users/2/email_addresses'
end
end
@@ -263,7 +263,7 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
},
:xhr => true
)
- assert_response 200
+ assert_response :ok
end
end
@@ -278,7 +278,7 @@ class EmailAddressesControllerTest < Redmine::ControllerTest
:id => User.find(2).email_address.id
}
)
- assert_response 404
+ assert_response :not_found
end
end
diff --git a/test/functional/enumerations_controller_test.rb b/test/functional/enumerations_controller_test.rb
index 06b56d024..a87d72d9f 100644
--- a/test/functional/enumerations_controller_test.rb
+++ b/test/functional/enumerations_controller_test.rb
@@ -35,7 +35,7 @@ class EnumerationsControllerTest < Redmine::ControllerTest
def test_index_should_require_admin
@request.session[:user_id] = nil
get :index
- assert_response 302
+ assert_response :found
end
def test_new
@@ -48,7 +48,7 @@ class EnumerationsControllerTest < Redmine::ControllerTest
def test_new_with_invalid_type_should_respond_with_404
get(:new, :params => {:type => 'UnknownType'})
- assert_response 404
+ assert_response :not_found
end
def test_create
@@ -128,7 +128,7 @@ class EnumerationsControllerTest < Redmine::ControllerTest
def test_edit_invalid_should_respond_with_404
get(:edit, :params => {:id => 999})
- assert_response 404
+ assert_response :not_found
end
def test_update
@@ -177,7 +177,7 @@ class EnumerationsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_equal 1, Enumeration.find(2).position
end
@@ -194,7 +194,7 @@ class EnumerationsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_equal "sample", enumeration.reload.custom_field_values.last.value
end
diff --git a/test/functional/groups_controller_test.rb b/test/functional/groups_controller_test.rb
index 23b84de7e..ede4efce3 100644
--- a/test/functional/groups_controller_test.rb
+++ b/test/functional/groups_controller_test.rb
@@ -72,7 +72,7 @@ class GroupsControllerTest < Redmine::ControllerTest
def test_show_invalid_should_return_404
get(:show, :params => {:id => 99})
- assert_response 404
+ assert_response :not_found
end
def test_show_group_that_is_not_visible_should_return_404
@@ -80,7 +80,7 @@ class GroupsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = nil
get :show, :params => {:id => 10}
- assert_response 404
+ assert_response :not_found
end
def test_show_should_display_only_visible_users
diff --git a/test/functional/imports_controller_test.rb b/test/functional/imports_controller_test.rb
index c368b64b9..42edf5ca5 100644
--- a/test/functional/imports_controller_test.rb
+++ b/test/functional/imports_controller_test.rb
@@ -61,7 +61,7 @@ class ImportsControllerTest < Redmine::ControllerTest
:file => uploaded_test_file('import_issues.csv', 'text/csv')
}
)
- assert_response 302
+ assert_response :found
end
assert_equal 2, import.user_id
assert_match /\A[0-9a-f]+\z/, import.filename
@@ -123,7 +123,7 @@ class ImportsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
import.reload
assert_equal 2, import.total_items
end
@@ -142,7 +142,7 @@ class ImportsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 200
+ assert_response :ok
import.reload
assert_nil import.total_items
assert_select 'div#flash_error', /not a valid UTF-8 encoded file/
@@ -162,7 +162,7 @@ class ImportsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 200
+ assert_response :ok
import.reload
assert_nil import.total_items
assert_select 'div#flash_error', /not a valid Shift_JIS encoded file/
@@ -182,7 +182,7 @@ class ImportsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 200
+ assert_response :ok
import.reload
assert_nil import.total_items
@@ -203,7 +203,7 @@ class ImportsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 200
+ assert_response :ok
import.reload
assert_equal 0, import.total_items
diff --git a/test/functional/issue_categories_controller_test.rb b/test/functional/issue_categories_controller_test.rb
index 0e527fdc5..62b2d42e4 100644
--- a/test/functional/issue_categories_controller_test.rb
+++ b/test/functional/issue_categories_controller_test.rb
@@ -170,7 +170,7 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 404
+ assert_response :not_found
end
def test_destroy_category_not_in_use
diff --git a/test/functional/issue_relations_controller_test.rb b/test/functional/issue_relations_controller_test.rb
index 2497309bd..fadf1011b 100644
--- a/test/functional/issue_relations_controller_test.rb
+++ b/test/functional/issue_relations_controller_test.rb
@@ -71,7 +71,7 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 404
+ assert_response :not_found
end
end
@@ -305,7 +305,7 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
def test_destroy_invalid_relation
assert_no_difference 'IssueRelation.count' do
delete(:destroy, :params => {:id => '999'})
- assert_response 404
+ assert_response :not_found
end
end
diff --git a/test/functional/issue_statuses_controller_test.rb b/test/functional/issue_statuses_controller_test.rb
index 099460624..c7594f9a0 100644
--- a/test/functional/issue_statuses_controller_test.rb
+++ b/test/functional/issue_statuses_controller_test.rb
@@ -42,7 +42,7 @@ class IssueStatusesControllerTest < Redmine::ControllerTest
def test_index_by_user_should_respond_with_406
@request.session[:user_id] = 2
get :index
- assert_response 406
+ assert_response :not_acceptable
end
def test_index_should_show_warning_when_no_workflow_is_defined
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index f7c879188..53cfd8146 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -705,7 +705,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:query_id => 999
}
)
- assert_response 404
+ assert_response :not_found
end
def test_index_with_cross_project_query_in_session_should_show_project_issues
@@ -734,7 +734,7 @@ class IssuesControllerTest < Redmine::ControllerTest
)
@request.session[:user_id] = 3
get(:index, :params => {:query_id => q.id})
- assert_response 403
+ assert_response :forbidden
end
def test_private_query_should_be_available_to_its_user
@@ -2392,28 +2392,28 @@ class IssuesControllerTest < Redmine::ControllerTest
Role.non_member.remove_permission!(:view_issues)
@request.session[:user_id] = 9
get(:show, :params => {:id => 1})
- assert_response 403
+ assert_response :forbidden
end
def test_show_should_deny_non_member_access_to_private_issue
Issue.where(:id => 1).update_all(["is_private = ?", true])
@request.session[:user_id] = 9
get(:show, :params => {:id => 1})
- assert_response 403
+ assert_response :forbidden
end
def test_show_should_deny_member_access_without_permission
Role.find(1).remove_permission!(:view_issues)
@request.session[:user_id] = 2
get(:show, :params => {:id => 1})
- assert_response 403
+ assert_response :forbidden
end
def test_show_should_deny_member_access_to_private_issue_without_permission
Issue.where(:id => 1).update_all(["is_private = ?", true])
@request.session[:user_id] = 3
get(:show, :params => {:id => 1})
- assert_response 403
+ assert_response :forbidden
end
def test_show_should_allow_author_access_to_private_issue
@@ -3158,7 +3158,7 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_show_invalid_should_respond_with_404
get(:show, :params => {:id => 999})
- assert_response 404
+ assert_response :not_found
end
def test_show_on_active_project_should_display_edit_links
@@ -3588,7 +3588,7 @@ class IssuesControllerTest < Redmine::ControllerTest
role.save!
@request.session[:user_id] = 2
get(:new, :params => {:project_id => 1})
- assert_response 403
+ assert_response :forbidden
end
def test_new_without_projects_should_respond_with_403
@@ -3596,7 +3596,7 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :new
- assert_response 403
+ assert_response :forbidden
assert_select_error /no projects/
end
@@ -3604,7 +3604,7 @@ class IssuesControllerTest < Redmine::ControllerTest
Project.all.each {|p| p.trackers.clear}
@request.session[:user_id] = 2
get :new
- assert_response 403
+ assert_response :forbidden
assert_select_error /no projects/
end
@@ -3873,7 +3873,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:project_id => 1
}
)
- assert_response 500
+ assert_response :internal_server_error
assert_select_error /No default issue/
end
@@ -3886,7 +3886,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:project_id => 1
}
)
- assert_response 500
+ assert_response :internal_server_error
assert_select_error /No tracker/
end
@@ -3898,7 +3898,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:project_id => 'invalid'
}
)
- assert_response 404
+ assert_response :not_found
end
def test_new_with_parent_id_should_only_propose_valid_trackers
@@ -4318,7 +4318,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
)
end
- assert_response 302
+ assert_response :found
issue = Issue.order('id DESC').first
assert_equal ['MySQL', 'Oracle'], issue.custom_field_value(1).sort
end
@@ -4344,7 +4344,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
)
end
- assert_response 302
+ assert_response :found
issue = Issue.order('id DESC').first
assert_equal [''], issue.custom_field_value(1).sort
end
@@ -4372,7 +4372,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
)
end
- assert_response 302
+ assert_response :found
issue = Issue.order('id DESC').first
assert_equal ['2', '3'], issue.custom_field_value(field).sort
end
@@ -4504,7 +4504,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
issue = Issue.order('id DESC').first
assert_equal Date.parse('2012-07-14'), issue.start_date
@@ -4530,7 +4530,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
assert_equal 3, issue.tracker_id
end
@@ -4587,7 +4587,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
issue = Issue.order('id DESC').first
assert_equal Issue.find(2), issue.parent
@@ -4607,7 +4607,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
issue = Issue.order('id DESC').first
assert_equal Issue.find(2), issue.parent
@@ -4707,7 +4707,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
issue = Issue.order('id DESC').first
assert_equal 3, issue.project_id
@@ -4747,7 +4747,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 422
+ assert_response :unprocessable_entity
end
end
@@ -5041,7 +5041,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
end
@@ -5365,7 +5365,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:copy_from => 99999
}
)
- assert_response 404
+ assert_response :not_found
end
def test_create_as_copy_on_different_project
@@ -6177,7 +6177,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
def test_put_update_with_tracker_change
@@ -6460,7 +6460,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_equal parent, issue.parent
end
@@ -6892,7 +6892,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_equal 'Changed subject', issue.reload.subject
end
@@ -6912,7 +6912,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_equal 'Original subject', issue.reload.subject
end
@@ -6929,7 +6929,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_equal 2, issue.reload.assigned_to_id
end
@@ -7279,7 +7279,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
# check that the issues were updated
assert_equal [7, 7], Issue.where(:id =>[1, 2]).collect {|i| i.priority.id}
@@ -7312,7 +7312,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_equal [group, group], Issue.where(:id => [1, 2]).collect {|i| i.assigned_to}
end
end
@@ -7334,7 +7334,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
# check that the issues were updated
assert_equal [7, 7, 7], Issue.find([1, 2, 6]).map(&:priority_id)
@@ -7365,7 +7365,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 403
+ assert_response :forbidden
assert_not_equal "Bulk should fail", Journal.last.notes
end
@@ -7385,7 +7385,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
# 4 emails for 2 members and 2 issues
# 1 email for a watcher of issue #2
assert_equal 5, ActionMailer::Base.deliveries.size
@@ -7472,7 +7472,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
issue = Issue.find(1)
assert issue.closed?
end
@@ -7542,7 +7542,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
parent = Issue.find(2)
assert_equal parent.id, Issue.find(1).parent_id
assert_equal parent.id, Issue.find(3).parent_id
@@ -7582,7 +7582,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
issue = Issue.find(1)
journal = issue.journals.reorder('created_on DESC').first
@@ -7608,7 +7608,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_equal '', Issue.find(1).custom_field_value(1)
assert_equal '', Issue.find(3).custom_field_value(1)
end
@@ -7631,7 +7631,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_equal ['MySQL', 'Oracle'], Issue.find(1).custom_field_value(1).sort
assert_equal ['MySQL', 'Oracle'], Issue.find(3).custom_field_value(1).sort
# the custom field is not associated with the issue tracker
@@ -7657,7 +7657,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_equal [''], Issue.find(1).custom_field_value(1)
assert_equal [''], Issue.find(3).custom_field_value(1)
end
@@ -7676,7 +7676,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
# check that the issues were updated
assert_nil Issue.find(2).assigned_to
end
@@ -7889,7 +7889,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:copy => '1'
}
)
- assert_response 302
+ assert_response :found
end
end
@@ -7906,7 +7906,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:copy => '1'
}
)
- assert_response 403
+ assert_response :forbidden
end
def test_bulk_copy_on_different_project_without_add_issues_permission_should_be_denied
@@ -7922,7 +7922,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:copy => '1'
}
)
- assert_response 403
+ assert_response :forbidden
end
def test_bulk_copy_should_allow_not_changing_the_issue_attributes
@@ -8364,7 +8364,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:reassign_to_id => target.id
}
)
- assert_response 302
+ assert_response :found
assert_equal 'Successful deletion.', flash[:notice]
end
end
@@ -8487,7 +8487,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
)
end
- assert_response 302
+ assert_response :found
assert_equal 'Successful deletion.', flash[:notice]
end
@@ -8496,7 +8496,7 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_no_difference 'Issue.count' do
delete(:destroy, :params => {:id => 999})
end
- assert_response 404
+ assert_response :not_found
end
def test_destroy_with_permission_on_tracker_should_be_allowed
@@ -8508,7 +8508,7 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_difference 'Issue.count', -1 do
delete(:destroy, :params => {:id => issue.id})
end
- assert_response 302
+ assert_response :found
assert_equal 'Successful deletion.', flash[:notice]
end
@@ -8521,7 +8521,7 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_no_difference 'Issue.count' do
delete(:destroy, :params => {:id => issue.id})
end
- assert_response 403
+ assert_response :forbidden
end
def test_default_search_scope
diff --git a/test/functional/issues_controller_transaction_test.rb b/test/functional/issues_controller_transaction_test.rb
index 1f4e2b268..5f7d5ba6b 100644
--- a/test/functional/issues_controller_transaction_test.rb
+++ b/test/functional/issues_controller_transaction_test.rb
@@ -246,7 +246,7 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
)
end
- assert_response 302
+ assert_response :found
issue = Issue.find(1)
assert_equal 4, issue.fixed_version_id
journal = Journal.order('id DESC').first
@@ -272,7 +272,7 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
)
end
- assert_response 302
+ assert_response :found
issue = Issue.find(1)
assert_nil issue.fixed_version_id
journal = Journal.order('id DESC').first
@@ -300,7 +300,7 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
)
end
- assert_response 302
+ assert_response :found
assert_equal 'add_privates_notes_conflict_resolution', journal.notes
assert_equal true, journal.private_notes
assert journal.details.empty?
@@ -361,7 +361,7 @@ class IssuesControllerTransactionTest < Redmine::ControllerTest
IssueQuery.any_instance.stubs(:statement).returns("INVALID STATEMENT")
get :index
- assert_response 500
+ assert_response :internal_server_error
assert_select 'p', :text => /An error occurred/
assert_nil session[:query]
assert_nil session[:issues_index_sort]
diff --git a/test/functional/issues_custom_fields_visibility_test.rb b/test/functional/issues_custom_fields_visibility_test.rb
index 524a6dc00..0e9712438 100644
--- a/test/functional/issues_custom_fields_visibility_test.rb
+++ b/test/functional/issues_custom_fields_visibility_test.rb
@@ -300,7 +300,7 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
assert_equal users_to_test.keys.size, ActionMailer::Base.deliveries.size
@@ -341,7 +341,7 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_equal users_to_test.keys.size, ActionMailer::Base.deliveries.size
# tests that each user receives 1 email with the custom fields he is allowed to see only
users_to_test.each do |user, fields|
@@ -378,7 +378,7 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
users_to_test.each do |user, fields|
mails = ActionMailer::Base.deliveries.select {|m| m.to.include? user.mail}
if (fields & [@field2, @field3]).any?
diff --git a/test/functional/journals_controller_test.rb b/test/functional/journals_controller_test.rb
index dbd8511cf..66887dc62 100644
--- a/test/functional/journals_controller_test.rb
+++ b/test/functional/journals_controller_test.rb
@@ -43,7 +43,7 @@ class JournalsControllerTest < Redmine::ControllerTest
:query_id => 999
}
)
- assert_response 404
+ assert_response :not_found
end
def test_index_should_return_privates_notes_with_permission_only
@@ -156,7 +156,7 @@ class JournalsControllerTest < Redmine::ControllerTest
:detail_id => detail.id
}
)
- assert_response 302
+ assert_response :found
end
def test_diff_should_default_to_description_diff
@@ -179,7 +179,7 @@ class JournalsControllerTest < Redmine::ControllerTest
def test_reply_to_issue_without_permission
@request.session[:user_id] = 7
get(:new, :params => {:id => 6}, :xhr => true)
- assert_response 403
+ assert_response :forbidden
end
def test_reply_to_note
@@ -224,7 +224,7 @@ class JournalsControllerTest < Redmine::ControllerTest
},
:xhr => true
)
- assert_response 404
+ assert_response :not_found
end
def test_edit_xhr
@@ -247,7 +247,7 @@ class JournalsControllerTest < Redmine::ControllerTest
Role.find(1).remove_permission! :view_private_notes
get(:edit, :params => {:id => journal.id}, :xhr => true)
- assert_response 404
+ assert_response :not_found
end
def test_update_xhr
diff --git a/test/functional/mail_handler_controller_test.rb b/test/functional/mail_handler_controller_test.rb
index 64b3e5dc3..3227fe5ca 100644
--- a/test/functional/mail_handler_controller_test.rb
+++ b/test/functional/mail_handler_controller_test.rb
@@ -49,7 +49,7 @@ class MailHandlerControllerTest < Redmine::ControllerTest
)
end
end
- assert_response 201
+ assert_response :created
end
def test_should_create_issue_with_options
@@ -74,7 +74,7 @@ class MailHandlerControllerTest < Redmine::ControllerTest
)
end
end
- assert_response 201
+ assert_response :created
issue = Issue.order(:id => :desc).first
assert_equal true, issue.is_private
end
@@ -97,7 +97,7 @@ class MailHandlerControllerTest < Redmine::ControllerTest
end
end
end
- assert_response 201
+ assert_response :created
end
def test_should_respond_with_422_if_not_created
@@ -117,7 +117,7 @@ class MailHandlerControllerTest < Redmine::ControllerTest
)
end
end
- assert_response 422
+ assert_response :unprocessable_entity
end
def test_should_not_allow_with_api_disabled
@@ -137,7 +137,7 @@ class MailHandlerControllerTest < Redmine::ControllerTest
)
end
end
- assert_response 403
+ assert_response :forbidden
assert_include 'Access denied', response.body
end
@@ -157,7 +157,7 @@ class MailHandlerControllerTest < Redmine::ControllerTest
)
end
end
- assert_response 403
+ assert_response :forbidden
assert_include 'Access denied', response.body
end
diff --git a/test/functional/members_controller_test.rb b/test/functional/members_controller_test.rb
index 0a368e10d..e97999f13 100644
--- a/test/functional/members_controller_test.rb
+++ b/test/functional/members_controller_test.rb
@@ -207,7 +207,7 @@ class MembersControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
member = Member.find(2)
assert member.user.locked?
assert_equal [1], member.role_ids
diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb
index 85f45f1d7..12a6d5f29 100644
--- a/test/functional/messages_controller_test.rb
+++ b/test/functional/messages_controller_test.rb
@@ -81,12 +81,12 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_show_message_not_found
get(:show, :params => {:board_id => 1, :id => 99999})
- assert_response 404
+ assert_response :not_found
end
def test_show_message_from_invalid_board_should_respond_with_404
get(:show, :params => {:board_id => 999, :id => 1})
- assert_response 404
+ assert_response :not_found
end
def test_show_should_display_watchers
@@ -125,7 +125,7 @@ class MessagesControllerTest < Redmine::ControllerTest
def test_get_new_with_invalid_board
@request.session[:user_id] = 2
get(:new, :params => {:board_id => 99})
- assert_response 404
+ assert_response :not_found
end
def test_post_new
@@ -321,7 +321,7 @@ class MessagesControllerTest < Redmine::ControllerTest
}
)
- assert_response 404
+ assert_response :not_found
end
def test_preview_new
diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb
index af3ed516b..da16e7c50 100644
--- a/test/functional/my_controller_test.rb
+++ b/test/functional/my_controller_test.rb
@@ -730,7 +730,7 @@ class MyControllerTest < Redmine::ControllerTest
:block => 'invalid'
}
)
- assert_response 422
+ assert_response :unprocessable_entity
end
def test_remove_block
diff --git a/test/functional/news_controller_test.rb b/test/functional/news_controller_test.rb
index 1a130b513..fbd609d1e 100644
--- a/test/functional/news_controller_test.rb
+++ b/test/functional/news_controller_test.rb
@@ -44,14 +44,14 @@ class NewsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get(:index, :params => {:project_id => 999})
- assert_response 404
+ assert_response :not_found
end
def test_index_with_invalid_project_should_respond_with_302_for_anonymous
Role.anonymous.remove_permission! :view_news
with_settings :login_required => '0' do
get(:index, :params => {:project_id => 999})
- assert_response 302
+ assert_response :found
end
end
@@ -60,7 +60,7 @@ class NewsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :index
- assert_response 403
+ assert_response :forbidden
end
def test_index_without_manage_news_permission_should_not_display_add_news_link
@@ -107,7 +107,7 @@ class NewsControllerTest < Redmine::ControllerTest
def test_show_not_found
get(:show, :params => {:id => 999})
- assert_response 404
+ assert_response :not_found
end
def test_get_new_with_project_id
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index d1de3b631..20cf61382 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -744,7 +744,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
project = Project.order('id desc').first
assert_equal 'inherited', project.name
@@ -839,7 +839,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
project = Project.find_by_identifier('ecookbook')
project.archive
get(:show, :params => {:id => 'ecookbook'})
- assert_response 403
+ assert_response :forbidden
assert_select 'p', :text => /archived/
assert_not_include project.name, response.body
end
@@ -849,7 +849,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
project = Project.find_by_identifier('ecookbook')
project.archive
get(:show, :params => {:id => 'ecookbook'})
- assert_response 403
+ assert_response :forbidden
assert_select 'a', :text => "Unarchive"
end
@@ -920,13 +920,13 @@ class ProjectsControllerTest < Redmine::ControllerTest
Project.find(1).close
@request.session[:user_id] = 2 # manager
get(:settings, :params => {:id => 1})
- assert_response 403
+ assert_response :forbidden
end
def test_settings_should_be_denied_for_anonymous_on_closed_project
Project.find(1).close
get(:settings, :params => {:id => 1})
- assert_response 403
+ assert_response :forbidden
end
def test_settings_should_accept_version_status_filter
@@ -1015,7 +1015,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
role.permissions = []
role.save
get(:settings, :params => {:id => project.id})
- assert_response 403
+ assert_response :forbidden
role.add_permission! :manage_repository, :manage_boards, :manage_project_activities
get(:settings, :params => {:id => project.id})
@@ -1105,7 +1105,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 403
+ assert_response :forbidden
assert_equal 'eCookbook', Project.find(1).name
end
@@ -1120,7 +1120,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 403
+ assert_response :forbidden
assert_equal 'eCookbook', Project.find(1).name
end
@@ -1138,7 +1138,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_match /Successful update/, flash[:notice]
end
@@ -1320,7 +1320,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
:confirm => 'ecookbook'
}
)
- assert_response 403
+ assert_response :forbidden
end
assert Project.find(1)
end
@@ -1328,7 +1328,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_bulk_destroy_should_require_admin
@request.session[:user_id] = 2 # non-admin
delete :bulk_destroy, params: { ids: [1, 2], confirm: 'Yes' }
- assert_response 403
+ assert_response :forbidden
end
def test_bulk_destroy_should_require_confirmation
@@ -1338,7 +1338,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
end
assert Project.find(1)
assert Project.find(2)
- assert_response 200
+ assert_response :ok
end
def test_bulk_destroy_should_delete_projects
@@ -1415,7 +1415,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
def test_get_copy_with_invalid_source_should_respond_with_404
@request.session[:user_id] = 1
get(:copy, :params => {:id => 99})
- assert_response 404
+ assert_response :not_found
end
def test_get_copy_should_preselect_custom_fields
diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb
index fa5c744b6..77560e913 100644
--- a/test/functional/queries_controller_test.rb
+++ b/test/functional/queries_controller_test.rb
@@ -34,7 +34,7 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_index
get :index
# HTML response not implemented
- assert_response 406
+ assert_response :not_acceptable
end
def test_new_project_query
@@ -62,7 +62,7 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_new_on_invalid_project
@request.session[:user_id] = 2
get(:new, :params => {:project_id => 'invalid'})
- assert_response 404
+ assert_response :not_found
end
def test_new_should_not_render_show_inline_columns_option_for_query_without_available_inline_columns
@@ -359,7 +359,7 @@ class QueriesControllerTest < Redmine::ControllerTest
}
)
end
- assert_response 403
+ assert_response :forbidden
end
def test_create_global_query_without_permission_should_fail
@@ -369,7 +369,7 @@ class QueriesControllerTest < Redmine::ControllerTest
assert_no_difference '::Query.count' do
post(:create, :params => {:query => {:name => 'Foo'}})
end
- assert_response 403
+ assert_response :forbidden
end
def test_create_global_query_from_gantt
@@ -393,7 +393,7 @@ class QueriesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
query = IssueQuery.order('id DESC').first
assert_redirected_to "/issues/gantt?query_id=#{query.id}"
@@ -424,7 +424,7 @@ class QueriesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
query = IssueQuery.order('id DESC').first
assert_redirected_to "/projects/ecookbook/issues/gantt?query_id=#{query.id}"
@@ -445,7 +445,7 @@ class QueriesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
assert_not_nil query.project
assert_equal Query::VISIBILITY_PRIVATE, query.visibility
@@ -464,7 +464,7 @@ class QueriesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
assert_nil query.project
assert_equal Query::VISIBILITY_PRIVATE, query.visibility
@@ -482,7 +482,7 @@ class QueriesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
assert_not_nil query.project
assert_equal Query::VISIBILITY_PUBLIC, query.visibility
@@ -501,7 +501,7 @@ class QueriesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
assert_nil query.project
assert_equal Query::VISIBILITY_PRIVATE, query.visibility
@@ -520,7 +520,7 @@ class QueriesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
assert_nil query.project
assert_equal Query::VISIBILITY_PUBLIC, query.visibility
@@ -662,7 +662,7 @@ class QueriesControllerTest < Redmine::ControllerTest
def test_edit_invalid_query
@request.session[:user_id] = 2
get(:edit, :params => {:id => 99})
- assert_response 404
+ assert_response :not_found
end
def test_update_global_private_query
diff --git a/test/functional/reports_controller_test.rb b/test/functional/reports_controller_test.rb
index 9f6624f6a..497176b1d 100644
--- a/test/functional/reports_controller_test.rb
+++ b/test/functional/reports_controller_test.rb
@@ -242,7 +242,7 @@ class ReportsControllerTest < Redmine::ControllerTest
:detail => 'invalid'
}
)
- assert_response 404
+ assert_response :not_found
end
def test_issue_report_details_should_csv_export
diff --git a/test/functional/repositories_bazaar_controller_test.rb b/test/functional/repositories_bazaar_controller_test.rb
index 36539a75f..cf1cb52c2 100644
--- a/test/functional/repositories_bazaar_controller_test.rb
+++ b/test/functional/repositories_bazaar_controller_test.rb
@@ -291,7 +291,7 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
}
)
end
- assert_response 302
+ assert_response :found
@project.reload
assert_nil @project.repository
end
@@ -317,7 +317,7 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
}
)
end
- assert_response 302
+ assert_response :found
@project.reload
assert_nil @project.repository
end
diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb
index f2d20e3d9..e73066809 100644
--- a/test/functional/repositories_controller_test.rb
+++ b/test/functional/repositories_controller_test.rb
@@ -93,7 +93,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
}
)
end
- assert_response 302
+ assert_response :found
repository = Repository.order('id DESC').first
assert_kind_of Repository::Subversion, repository
assert_equal 'file:///test', repository.url
@@ -138,7 +138,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_equal 'test_update', Repository.find(11).password
end
@@ -162,7 +162,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
assert_difference 'Repository.count', -1 do
delete(:destroy, :params => {:id => 11})
end
- assert_response 302
+ assert_response :found
assert_nil Repository.find_by_id(11)
end
@@ -279,7 +279,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
:repository_id => 'foo'
}
)
- assert_response 404
+ assert_response :not_found
end
def test_revision
@@ -523,7 +523,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
}
}
)
- assert_response 302
+ assert_response :found
assert_equal User.find(2), c.reload.user
end
end
diff --git a/test/functional/repositories_cvs_controller_test.rb b/test/functional/repositories_cvs_controller_test.rb
index d28f34e8e..9c0e50526 100644
--- a/test/functional/repositories_cvs_controller_test.rb
+++ b/test/functional/repositories_cvs_controller_test.rb
@@ -305,7 +305,7 @@ class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest
assert_difference 'Repository.count', -1 do
delete(:destroy, :params => {:id => @repository.id})
end
- assert_response 302
+ assert_response :found
@project.reload
assert_nil @project.repository
end
@@ -327,7 +327,7 @@ class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest
assert_difference 'Repository.count', -1 do
delete(:destroy, :params => {:id => @repository.id})
end
- assert_response 302
+ assert_response :found
@project.reload
assert_nil @project.repository
end
diff --git a/test/functional/repositories_filesystem_controller_test.rb b/test/functional/repositories_filesystem_controller_test.rb
index 0428ab9d1..54d3eea7c 100644
--- a/test/functional/repositories_filesystem_controller_test.rb
+++ b/test/functional/repositories_filesystem_controller_test.rb
@@ -176,7 +176,7 @@ class RepositoriesFilesystemControllerTest < Redmine::RepositoryControllerTest
}
)
end
- assert_response 302
+ assert_response :found
@project.reload
assert_nil @project.repository
end
@@ -198,7 +198,7 @@ class RepositoriesFilesystemControllerTest < Redmine::RepositoryControllerTest
}
)
end
- assert_response 302
+ assert_response :found
@project.reload
assert_nil @project.repository
end
diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb
index d20918d5a..fee41faac 100644
--- a/test/functional/repositories_git_controller_test.rb
+++ b/test/functional/repositories_git_controller_test.rb
@@ -63,7 +63,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest
}
)
end
- assert_response 302
+ assert_response :found
repository = Repository.order('id DESC').first
assert_kind_of Repository::Git, repository
assert_equal '/test', repository.url
@@ -78,7 +78,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest
}
}
)
- assert_response 302
+ assert_response :found
repo2 = Repository.find(repository.id)
assert_equal false, repo2.report_last_commit
end
@@ -764,7 +764,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest
:rev => r
}
)
- assert_response 404
+ assert_response :not_found
assert_select_error /was not found/
end
end
@@ -784,7 +784,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest
}
)
end
- assert_response 302
+ assert_response :found
@project.reload
assert_nil @project.repository
end
@@ -811,7 +811,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest
}
)
end
- assert_response 302
+ assert_response :found
@project.reload
assert_nil @project.repository
end
diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb
index 52611141f..9e0d398b1 100644
--- a/test/functional/repositories_mercurial_controller_test.rb
+++ b/test/functional/repositories_mercurial_controller_test.rb
@@ -512,7 +512,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest
:path => repository_path_hash(['sources', 'welcome_controller.rb'])[:param]
}
)
- assert_response 404
+ assert_response :not_found
assert_select_error /was not found/
end
@@ -614,7 +614,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest
:rev => r
}
)
- assert_response 404
+ assert_response :not_found
assert_select_error /was not found/
end
end
@@ -633,7 +633,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest
}
)
end
- assert_response 302
+ assert_response :found
@project.reload
assert_nil @project.repository
end
@@ -658,7 +658,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest
}
)
end
- assert_response 302
+ assert_response :found
@project.reload
assert_nil @project.repository
end
diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb
index fa49d818e..7b32fa1f7 100644
--- a/test/functional/repositories_subversion_controller_test.rb
+++ b/test/functional/repositories_subversion_controller_test.rb
@@ -414,7 +414,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
:rev => 'something_weird'
}
)
- assert_response 404
+ assert_response :not_found
assert_select_error /was not found/
end
@@ -428,7 +428,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
:rev_to => 'something_weird'
}
)
- assert_response 404
+ assert_response :not_found
assert_select_error /was not found/
end
@@ -446,7 +446,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
:rev => r
}
)
- assert_response 404
+ assert_response :not_found
assert_select_error /was not found/
end
end
@@ -599,7 +599,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
assert_difference 'Repository.count', -1 do
delete(:destroy, :params => {:id => @repository.id})
end
- assert_response 302
+ assert_response :found
@project.reload
assert_nil @project.repository
end
@@ -619,7 +619,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
assert_difference 'Repository.count', -1 do
delete(:destroy, :params => {:id => @repository.id})
end
- assert_response 302
+ assert_response :found
@project.reload
assert_nil @project.repository
end
diff --git a/test/functional/roles_controller_test.rb b/test/functional/roles_controller_test.rb
index 5d2f94dc3..0918be6f0 100644
--- a/test/functional/roles_controller_test.rb
+++ b/test/functional/roles_controller_test.rb
@@ -160,7 +160,7 @@ class RolesControllerTest < Redmine::ControllerTest
}
}
)
- assert_response 302
+ assert_response :found
end
assert_equal false, role.all_roles_managed
assert_equal [2, 3], role.managed_role_ids.sort
@@ -186,7 +186,7 @@ class RolesControllerTest < Redmine::ControllerTest
def test_edit_invalid_should_respond_with_404
get :edit, :params => {:id => 999}
- assert_response 404
+ assert_response :not_found
end
def test_update
diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb
index 21b1fc274..d9a397343 100644
--- a/test/functional/search_controller_test.rb
+++ b/test/functional/search_controller_test.rb
@@ -48,18 +48,18 @@ class SearchControllerTest < Redmine::ControllerTest
def test_search_on_archived_project_should_return_403
Project.find(3).archive
get :index, :params => {:id => 3}
- assert_response 403
+ assert_response :forbidden
end
def test_search_on_invisible_project_by_user_should_be_denied
@request.session[:user_id] = 7
get :index, :params => {:id => 2}
- assert_response 403
+ assert_response :forbidden
end
def test_search_on_invisible_project_by_anonymous_user_should_redirect
get :index, :params => {:id => 2}
- assert_response 302
+ assert_response :found
end
def test_search_on_private_project_by_member_should_succeed
@@ -352,7 +352,7 @@ class SearchControllerTest < Redmine::ControllerTest
def test_search_with_invalid_project_id
get :index, :params => {:id => 195, :q => 'recipe'}
- assert_response 404
+ assert_response :not_found
end
def test_search_should_include_closed_projects
diff --git a/test/functional/settings_controller_test.rb b/test/functional/settings_controller_test.rb
index cee769a16..3c013146e 100644
--- a/test/functional/settings_controller_test.rb
+++ b/test/functional/settings_controller_test.rb
@@ -219,7 +219,7 @@ class SettingsControllerTest < Redmine::ControllerTest
def test_get_invalid_plugin_settings
get :plugin, :params => {:id => 'none'}
- assert_response 404
+ assert_response :not_found
end
def test_get_non_configurable_plugin_settings
@@ -228,7 +228,7 @@ class SettingsControllerTest < Redmine::ControllerTest
end
get :plugin, :params => {:id => 'foo'}
- assert_response 404
+ assert_response :not_found
ensure
Redmine::Plugin.unregister(:foo)
@@ -274,7 +274,7 @@ class SettingsControllerTest < Redmine::ControllerTest
:id => 'foo',
:settings => {'sample_setting' => 'Value'}
}
- assert_response 404
+ assert_response :not_found
ensure
Redmine::Plugin.unregister(:foo)
diff --git a/test/functional/sys_controller_test.rb b/test/functional/sys_controller_test.rb
index 41986deb5..fb116b4d9 100644
--- a/test/functional/sys_controller_test.rb
+++ b/test/functional/sys_controller_test.rb
@@ -118,13 +118,13 @@ class SysControllerTest < Redmine::ControllerTest
def test_fetch_changesets_unknown_project
get :fetch_changesets, :params => {:id => 'unknown'}
- assert_response 404
+ assert_response :not_found
end
def test_disabled_ws_should_respond_with_403_error
with_settings :sys_api_enabled => '0' do
get :projects
- assert_response 403
+ assert_response :forbidden
assert_include 'Access denied', response.body
end
end
@@ -139,7 +139,7 @@ class SysControllerTest < Redmine::ControllerTest
def test_wrong_key_should_respond_with_403_error
with_settings :sys_api_enabled => 'my_secret_key' do
get :projects, :params => {:key => 'wrong_key'}
- assert_response 403
+ assert_response :forbidden
assert_include 'Access denied', response.body
end
end
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index f3ef5cbe3..464bf9327 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -86,7 +86,7 @@ class TimelogControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 3
get :new
- assert_response 403
+ assert_response :forbidden
end
def test_new_should_select_default_role_activity
@@ -504,7 +504,7 @@ class TimelogControllerTest < Redmine::ControllerTest
:hours => '7.3'
}
}
- assert_response 403
+ assert_response :forbidden
end
def test_create_without_project_and_issue_should_fail
@@ -582,7 +582,7 @@ class TimelogControllerTest < Redmine::ControllerTest
}
end
- assert_response 403
+ assert_response :forbidden
end
def test_create_without_project_with_failure
@@ -636,7 +636,7 @@ class TimelogControllerTest < Redmine::ControllerTest
:issue_id => '5'
}
}
- assert_response 302
+ assert_response :found
entry.reload
assert_equal 5, entry.issue_id
@@ -668,7 +668,7 @@ class TimelogControllerTest < Redmine::ControllerTest
:project_id => '2'
}
}
- assert_response 302
+ assert_response :found
entry.reload
assert_equal 2, entry.project_id
@@ -802,7 +802,7 @@ class TimelogControllerTest < Redmine::ControllerTest
# update time entry activity
post :bulk_update, :params => {:ids => [1, 2], :time_entry => {:activity_id => 9}}
- assert_response 302
+ assert_response :found
# check that the issues were updated
assert_equal [9, 9], TimeEntry.where(:id => [1, 2]).collect {|i| i.activity_id}
end
@@ -823,7 +823,7 @@ class TimelogControllerTest < Redmine::ControllerTest
# update time entry activity
post :bulk_update, :params => {:ids => [1, 2, 4], :time_entry => {:activity_id => 9}}
- assert_response 302
+ assert_response :found
# check that the issues were updated
assert_equal [9, 9, 9], TimeEntry.where(:id => [1, 2, 4]).collect {|i| i.activity_id}
end
@@ -836,7 +836,7 @@ class TimelogControllerTest < Redmine::ControllerTest
assert ! user.allowed_to?(action, TimeEntry.find(5).project)
post :bulk_update, :params => {:ids => [1, 5], :time_entry => {:activity_id => 9}}
- assert_response 403
+ assert_response :forbidden
end
def test_bulk_update_with_edit_own_time_entries_permission
@@ -846,7 +846,7 @@ class TimelogControllerTest < Redmine::ControllerTest
ids = (0..1).map {TimeEntry.generate!(:user => User.find(2)).id}
post :bulk_update, :params => {:ids => ids, :time_entry => {:activity_id => 9}}
- assert_response 302
+ assert_response :found
end
def test_bulk_update_with_edit_own_time_entries_permissions_should_be_denied_for_time_entries_of_other_user
@@ -855,7 +855,7 @@ class TimelogControllerTest < Redmine::ControllerTest
Role.find_by_name('Manager').add_permission! :edit_own_time_entries
post :bulk_update, :params => {:ids => [1, 2], :time_entry => {:activity_id => 9}}
- assert_response 403
+ assert_response :forbidden
end
def test_bulk_update_custom_field
@@ -867,7 +867,7 @@ class TimelogControllerTest < Redmine::ControllerTest
:time_entry => {:custom_field_values => {'10' => '0'}}
}
)
- assert_response 302
+ assert_response :found
assert_equal ["0", "0"], TimeEntry.where(:id => [1, 2]).collect {|i| i.custom_value_for(10).value}
end
@@ -881,7 +881,7 @@ class TimelogControllerTest < Redmine::ControllerTest
:time_entry => {:custom_field_values => {field.id.to_s => '__none__'}}
}
)
- assert_response 302
+ assert_response :found
assert_equal ["", ""], TimeEntry.where(:id => [1, 2]).collect {|i| i.custom_value_for(field).value}
end
@@ -906,7 +906,7 @@ class TimelogControllerTest < Redmine::ControllerTest
Role.find_by_name('Manager').remove_permission! :edit_time_entries
post :bulk_update, :params => {:ids => [1, 2]}
- assert_response 403
+ assert_response :forbidden
end
def test_destroy
diff --git a/test/functional/trackers_controller_test.rb b/test/functional/trackers_controller_test.rb
index 196dcce1a..c2d2405e3 100644
--- a/test/functional/trackers_controller_test.rb
+++ b/test/functional/trackers_controller_test.rb
@@ -42,7 +42,7 @@ class TrackersControllerTest < Redmine::ControllerTest
def test_index_by_user_should_respond_with_406
@request.session[:user_id] = 2
get :index
- assert_response 406
+ assert_response :not_acceptable
end
def test_new
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index 387e965a5..4302f913a 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -335,13 +335,13 @@ class UsersControllerTest < Redmine::ControllerTest
def test_show_inactive
@request.session[:user_id] = nil
get :show, :params => {:id => 5}
- assert_response 404
+ assert_response :not_found
end
def test_show_inactive_by_admin
@request.session[:user_id] = 1
get :show, :params => {:id => 5}
- assert_response 200
+ assert_response :ok
assert_select 'h2', :text => /Dave2 Lopper2/
end
@@ -351,7 +351,7 @@ class UsersControllerTest < Redmine::ControllerTest
@request.session[:user_id] = nil
get :show, :params => {:id => user.id}
- assert_response 404
+ assert_response :not_found
end
def test_show_displays_memberships_based_on_project_visibility
@@ -378,7 +378,7 @@ class UsersControllerTest < Redmine::ControllerTest
def test_show_current_should_require_authentication
@request.session[:user_id] = nil
get :show, :params => {:id => 'current'}
- assert_response 302
+ assert_response :found
end
def test_show_current
@@ -656,7 +656,7 @@ class UsersControllerTest < Redmine::ControllerTest
get :edit, :params => {:id => 6}
- assert_response 404
+ assert_response :not_found
end
def test_edit_user_with_full_text_formatting_custom_field_should_not_fail
@@ -857,7 +857,7 @@ class UsersControllerTest < Redmine::ControllerTest
:id => 2,
:user => {:status => 3}
}
- assert_response 302
+ assert_response :found
user = User.find(2)
assert_equal 3, user.status
assert_equal '1', user.pref[:no_self_notified]
@@ -997,7 +997,7 @@ class UsersControllerTest < Redmine::ControllerTest
def test_update_should_be_denied_for_anonymous
assert User.find(6).anonymous?
put :update, :params => {:id => 6}
- assert_response 404
+ assert_response :not_found
end
def test_update_with_blank_email_should_not_raise_exception
@@ -1051,7 +1051,7 @@ class UsersControllerTest < Redmine::ControllerTest
assert_no_difference 'User.count' do
delete :destroy, :params => {:id => 2, :confirm => User.find(2).login}
end
- assert_response 403
+ assert_response :forbidden
end
def test_destroy_should_be_denied_for_anonymous
@@ -1059,7 +1059,7 @@ class UsersControllerTest < Redmine::ControllerTest
assert_no_difference 'User.count' do
delete :destroy, :params => {:id => 6, :confirm => User.find(6).login}
end
- assert_response 404
+ assert_response :not_found
end
def test_destroy_should_redirect_to_back_url_param
@@ -1105,7 +1105,7 @@ class UsersControllerTest < Redmine::ControllerTest
assert_no_difference 'User.count' do
delete :destroy, params: {id: user.id}
end
- assert_response 422
+ assert_response :unprocessable_entity
end
end
@@ -1116,7 +1116,7 @@ class UsersControllerTest < Redmine::ControllerTest
assert_no_difference 'User.count' do
delete :destroy, params: {id: user.id}
end
- assert_response 422
+ assert_response :unprocessable_entity
end
end
@@ -1166,7 +1166,7 @@ class UsersControllerTest < Redmine::ControllerTest
assert_no_difference 'User.count' do
delete :bulk_destroy, :params => {:ids => [2], :confirm => 'Yes'}
end
- assert_response 403
+ assert_response :forbidden
end
def test_bulk_destroy_should_be_denied_for_anonymous
@@ -1174,6 +1174,6 @@ class UsersControllerTest < Redmine::ControllerTest
assert_no_difference 'User.count' do
delete :bulk_destroy, :params => {:ids => [6], :confirm => "Yes"}
end
- assert_response 404
+ assert_response :not_found
end
end
diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb
index 369d30b5b..d8719a991 100644
--- a/test/functional/watchers_controller_test.rb
+++ b/test/functional/watchers_controller_test.rb
@@ -86,7 +86,7 @@ class WatchersControllerTest < Redmine::ControllerTest
assert_no_difference 'Watcher.count' do
post :watch, :params => {:object_type => 'enabled_module', :object_id => m.id.to_s}, :xhr => true
- assert_response 403
+ assert_response :forbidden
end
end
@@ -95,7 +95,7 @@ class WatchersControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 3
assert_no_difference('Watcher.count') do
post :watch, :params => {:object_type => 'issue', :object_id => '1'}, :xhr => true
- assert_response 403
+ assert_response :forbidden
end
end
@@ -103,7 +103,7 @@ class WatchersControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 3
assert_no_difference('Watcher.count') do
post :watch, :params => {:object_type => 'foo', :object_id => '1'}, :xhr => true
- assert_response 404
+ assert_response :not_found
end
end
@@ -111,7 +111,7 @@ class WatchersControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 3
assert_no_difference('Watcher.count') do
post :watch, :params => {:object_type => 'issue', :object_id => '999'}, :xhr => true
- assert_response 404
+ assert_response :not_found
end
end
@@ -159,7 +159,7 @@ class WatchersControllerTest < Redmine::ControllerTest
def test_new_as_html_should_respond_with_404
@request.session[:user_id] = 2
get :new, :params => {:object_type => 'issue', :object_id => '2'}
- assert_response 404
+ assert_response :not_found
end
def test_new_for_message
@@ -581,7 +581,7 @@ class WatchersControllerTest < Redmine::ControllerTest
delete :destroy, :params => {
:object_type => 'issue', :object_id => '2', :user_id => '999'
}
- assert_response 404
+ assert_response :not_found
end
end
end
diff --git a/test/functional/welcome_controller_test.rb b/test/functional/welcome_controller_test.rb
index e157a0c85..fde599383 100644
--- a/test/functional/welcome_controller_test.rb
+++ b/test/functional/welcome_controller_test.rb
@@ -183,7 +183,7 @@ class WelcomeControllerTest < Redmine::ControllerTest
WelcomeController.any_instance.stubs(:index).raises(::Unauthorized)
get :index
- assert_response 302
+ assert_response :found
assert_redirected_to('/login?back_url='+CGI.escape('http://test.host/'))
end
@@ -192,6 +192,6 @@ class WelcomeControllerTest < Redmine::ControllerTest
@request.env["HTTP_X_REQUESTED_WITH"] = "XMLHttpRequest"
get :index
- assert_response 401
+ assert_response :unauthorized
end
end
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb
index 31dcf395d..d7e9676f8 100644
--- a/test/functional/wiki_controller_test.rb
+++ b/test/functional/wiki_controller_test.rb
@@ -179,7 +179,7 @@ class WikiControllerTest < Redmine::ControllerTest
def test_show_unexistent_page_without_edit_right
get :show, :params => {:project_id => 1, :id => 'Unexistent page'}
- assert_response 404
+ assert_response :not_found
end
def test_show_unexistent_page_with_edit_right
@@ -191,7 +191,7 @@ class WikiControllerTest < Redmine::ControllerTest
def test_show_specific_version_of_an_unexistent_page_without_edit_right
get :show, :params => {:project_id => 1, :id => 'Unexistent page', :version => 1}
- assert_response 404
+ assert_response :not_found
end
def test_show_unexistent_page_with_parent_should_preselect_parent
@@ -204,14 +204,14 @@ class WikiControllerTest < Redmine::ControllerTest
def test_show_unexistent_version_page
@request.session[:user_id] = 2
get :show, :params => {:project_id => 1, :id => 'CookBook_documentation', :version => 100}
- assert_response 404
+ assert_response :not_found
end
def test_show_should_not_show_history_without_permission
Role.anonymous.remove_permission! :view_wiki_edits
get :show, :params => {:project_id => 1, :id => 'Page with sections', :version => 2}
- assert_response 302
+ assert_response :found
end
def test_show_page_without_content_should_display_the_edit_form
@@ -386,7 +386,7 @@ class WikiControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
get :edit, :params => {:project_id => 'ecookbook', :id => 'Page_with_sections', :section => 10}
- assert_response 404
+ assert_response :not_found
end
def test_update_page
@@ -598,7 +598,7 @@ class WikiControllerTest < Redmine::ControllerTest
:id => 'NoContent',
:content => {:text => 'Some content'}
}
- assert_response 302
+ assert_response :found
end
end
assert_equal 'Some content', page.reload.content.text
@@ -780,7 +780,7 @@ class WikiControllerTest < Redmine::ControllerTest
:project_id => 1, :id => 'CookBook_documentation',
:version => '99'
}
- assert_response 404
+ assert_response :not_found
end
def test_diff_with_invalid_version_from_should_respond_with_404
@@ -789,7 +789,7 @@ class WikiControllerTest < Redmine::ControllerTest
:version => '99',
:version_from => '98'
}
- assert_response 404
+ assert_response :not_found
end
def test_annotate
@@ -825,7 +825,7 @@ class WikiControllerTest < Redmine::ControllerTest
:project_id => 1, :id => 'CookBook_documentation',
:version => '99'
}
- assert_response 404
+ assert_response :not_found
end
def test_get_rename
@@ -1040,7 +1040,7 @@ class WikiControllerTest < Redmine::ControllerTest
end
end
end
- assert_response 404
+ assert_response :not_found
end
def test_index
@@ -1097,7 +1097,7 @@ class WikiControllerTest < Redmine::ControllerTest
Role.find_by_name('Manager').remove_permission! :export_wiki_pages
get :export, :params => {:project_id => 'ecookbook'}
- assert_response 403
+ assert_response :forbidden
end
def test_date_index
@@ -1110,7 +1110,7 @@ class WikiControllerTest < Redmine::ControllerTest
def test_not_found
get :show, :params => {:project_id => 999}
- assert_response 404
+ assert_response :not_found
end
def test_protect_page
@@ -1237,7 +1237,7 @@ class WikiControllerTest < Redmine::ControllerTest
# Non members cannot edit protected wiki pages
@request.session[:user_id] = 4
get :edit, :params => {:project_id => 1, :id => 'CookBook_documentation'}
- assert_response 403
+ assert_response :forbidden
end
def test_edit_protected_page_by_member
@@ -1248,7 +1248,7 @@ class WikiControllerTest < Redmine::ControllerTest
def test_history_of_non_existing_page_should_return_404
get :history, :params => {:project_id => 1, :id => 'Unknown_page'}
- assert_response 404
+ assert_response :not_found
end
def test_add_attachment
diff --git a/test/functional/wikis_controller_test.rb b/test/functional/wikis_controller_test.rb
index 59cf9f6e8..1f5bf8948 100644
--- a/test/functional/wikis_controller_test.rb
+++ b/test/functional/wikis_controller_test.rb
@@ -51,6 +51,6 @@ class WikisControllerTest < Redmine::ControllerTest
def test_not_found
@request.session[:user_id] = 1
post :destroy, :params => {:id => 999, :confirm => 1}
- assert_response 404
+ assert_response :not_found
end
end
diff --git a/test/functional/workflows_controller_test.rb b/test/functional/workflows_controller_test.rb
index c543ebd6b..36fb311d9 100644
--- a/test/functional/workflows_controller_test.rb
+++ b/test/functional/workflows_controller_test.rb
@@ -158,7 +158,7 @@ class WorkflowsControllerTest < Redmine::ControllerTest
'3' => {'1' => {'always' => '1'}, '2' => {'always' => '1'}}
}
}
- assert_response 302
+ assert_response :found
assert_equal 3, WorkflowTransition.where(:tracker_id => 1, :role_id => 2).count
assert WorkflowTransition.where(:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 2).exists?
@@ -175,7 +175,7 @@ class WorkflowsControllerTest < Redmine::ControllerTest
'0' => {'1' => {'always' => '1'}, '2' => {'always' => '1'}}
}
}
- assert_response 302
+ assert_response :found
assert WorkflowTransition.where(:role_id => 2, :tracker_id => 1, :old_status_id => 0, :new_status_id => 1).any?
assert WorkflowTransition.where(:role_id => 2, :tracker_id => 1, :old_status_id => 0, :new_status_id => 2).any?
@@ -195,7 +195,7 @@ class WorkflowsControllerTest < Redmine::ControllerTest
'4' => {'always' => '0', 'author' => '1', 'assignee' => '1'}}
}
}
- assert_response 302
+ assert_response :found
assert_equal 4, WorkflowTransition.where(:tracker_id => 1, :role_id => 2).count
@@ -371,7 +371,7 @@ class WorkflowsControllerTest < Redmine::ControllerTest
'3' => {'assigned_to_id' => '', 'fixed_version_id' => '', 'due_date' => ''}
}
}
- assert_response 302
+ assert_response :found
workflows = WorkflowPermission.all
assert_equal 3, workflows.size
@@ -409,7 +409,7 @@ class WorkflowsControllerTest < Redmine::ControllerTest
:source_tracker_id => '1', :source_role_id => '2',
:target_tracker_ids => ['3'], :target_role_ids => ['1']
}
- assert_response 302
+ assert_response :found
assert_equal source_transitions, status_transitions(:tracker_id => 3, :role_id => 1)
end
@@ -420,7 +420,7 @@ class WorkflowsControllerTest < Redmine::ControllerTest
:source_tracker_id => '1', :source_role_id => '2',
:target_tracker_ids => ['2', '3'], :target_role_ids => ['1', '3']
}
- assert_response 302
+ assert_response :found
assert_equal source_transitions, status_transitions(:tracker_id => 2, :role_id => 1)
assert_equal source_transitions, status_transitions(:tracker_id => 3, :role_id => 1)
assert_equal source_transitions, status_transitions(:tracker_id => 2, :role_id => 3)
@@ -435,7 +435,7 @@ class WorkflowsControllerTest < Redmine::ControllerTest
:source_tracker_id => 'any', :source_role_id => '2',
:target_tracker_ids => ['2', '3'], :target_role_ids => ['1', '3']
}
- assert_response 302
+ assert_response :found
assert_equal source_t2, status_transitions(:tracker_id => 2, :role_id => 1)
assert_equal source_t3, status_transitions(:tracker_id => 3, :role_id => 1)
assert_equal source_t2, status_transitions(:tracker_id => 2, :role_id => 3)
@@ -448,7 +448,7 @@ class WorkflowsControllerTest < Redmine::ControllerTest
:source_tracker_id => '', :source_role_id => '2',
:target_tracker_ids => ['2', '3'], :target_role_ids => ['1', '3']
}
- assert_response 200
+ assert_response :ok
assert_select 'div.flash.error', :text => 'Please select a source tracker or role'
end
end
@@ -459,7 +459,7 @@ class WorkflowsControllerTest < Redmine::ControllerTest
:source_tracker_id => '1', :source_role_id => '2',
:target_tracker_ids => ['2', '3']
}
- assert_response 200
+ assert_response :ok
assert_select 'div.flash.error', :text => 'Please select target tracker(s) and role(s)'
end
end