diff options
author | William George <code@williamgeorge.co.uk> | 2018-10-18 12:06:44 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-10-18 12:06:44 +0300 |
commit | 1b153d497b6948932b0de2f0088fe7192eb0994a (patch) | |
tree | a4f93a1c3a12314b54b2486d5b471c929d4e7003 /spec/requests/api/helpers_spec.rb | |
parent | c5d8e7fcee6bb15376902e8f1336f1ed368b9da8 (diff) |
Make getting a user by the username case insensitive
Diffstat (limited to 'spec/requests/api/helpers_spec.rb')
-rw-r--r-- | spec/requests/api/helpers_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/requests/api/helpers_spec.rb b/spec/requests/api/helpers_spec.rb index 0a789d58fd8..cca449e9e56 100644 --- a/spec/requests/api/helpers_spec.rb +++ b/spec/requests/api/helpers_spec.rb @@ -368,6 +368,14 @@ describe API::Helpers do it_behaves_like 'successful sudo' end + context 'when providing username (case insensitive)' do + before do + env[API::Helpers::SUDO_HEADER] = user.username.upcase + end + + it_behaves_like 'successful sudo' + end + context 'when providing user ID' do before do env[API::Helpers::SUDO_HEADER] = user.id.to_s @@ -386,6 +394,14 @@ describe API::Helpers do it_behaves_like 'successful sudo' end + context 'when providing username (case insensitive)' do + before do + set_param(API::Helpers::SUDO_PARAM, user.username.upcase) + end + + it_behaves_like 'successful sudo' + end + context 'when providing user ID' do before do set_param(API::Helpers::SUDO_PARAM, user.id.to_s) |