Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2019-02-13 01:26:07 +0300
committerRobert Speicher <rspeicher@gmail.com>2019-02-13 01:28:06 +0300
commit12c70e636c432a5388f6fcb2508a9644ed24aa5c (patch)
tree6f207546bd92cc9916ae02b8e7e70ea09cbc83d7 /spec/controllers/admin
parenta58e92fc1b96c6967d160473d5c8dff17bf18775 (diff)
Admin section finds users case-insensitively
Previously, if you entered a username in the URL manually to view a specific user, the lookup was done case-sensitively, despite usernames being case-insensitive, often resulting in a 404. We now use the same `find_routable!` logic as the non-admin Users controller.
Diffstat (limited to 'spec/controllers/admin')
-rw-r--r--spec/controllers/admin/users_controller_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb
index 6b66cbd2651..c934db9e237 100644
--- a/spec/controllers/admin/users_controller_spec.rb
+++ b/spec/controllers/admin/users_controller_spec.rb
@@ -8,6 +8,17 @@ describe Admin::UsersController do
sign_in(admin)
end
+ describe 'GET :id' do
+ it 'finds a user case-insensitively' do
+ user = create(:user, username: 'CaseSensitive')
+
+ get :show, params: { id: user.username.downcase }
+
+ expect(response).to be_redirect
+ expect(response.location).to end_with(user.username)
+ end
+ end
+
describe 'DELETE #user with projects' do
let(:project) { create(:project, namespace: user.namespace) }
let!(:issue) { create(:issue, author: user) }