diff options
author | Robert Speicher <rspeicher@gmail.com> | 2019-02-13 01:26:07 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2019-02-13 01:28:06 +0300 |
commit | 12c70e636c432a5388f6fcb2508a9644ed24aa5c (patch) | |
tree | 6f207546bd92cc9916ae02b8e7e70ea09cbc83d7 /spec/controllers/admin | |
parent | a58e92fc1b96c6967d160473d5c8dff17bf18775 (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.rb | 11 |
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) } |