Fix RuboCop offense Rails/HttpStatus (#39889).

git-svn-id: https://svn.redmine.org/redmine/trunk@22837 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2024-05-18 05:56:55 +00:00
parent 58e9cd420a
commit a9518e28b8
83 changed files with 376 additions and 398 deletions

View File

@@ -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