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:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-04-04 10:59:35 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2018-04-04 10:59:35 +0300
commit3faa7653d0efc76c42d5b5cb6dcb93b3a69718a9 (patch)
tree99b928e92851a83c9631bcf9d0cf9e2ce43b52fc /spec/controllers/profiles_controller_spec.rb
parentbe1523c1ba9fa439a2525a1b18179a419ecb6b2d (diff)
Handle invalid params when trying update_username
Using strong params to require the presence of a username when calling `update_username`. Otherwise we'd raise a `NoMethodError` validating the paths on disk.
Diffstat (limited to 'spec/controllers/profiles_controller_spec.rb')
-rw-r--r--spec/controllers/profiles_controller_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb
index 03cbbb21e62..891485406c6 100644
--- a/spec/controllers/profiles_controller_spec.rb
+++ b/spec/controllers/profiles_controller_spec.rb
@@ -84,6 +84,13 @@ describe ProfilesController, :request_store do
expect(user.username).to eq(new_username)
end
+ it 'raises a correct error when the username is missing' do
+ sign_in(user)
+
+ expect { put :update_username, user: { gandalf: 'you shall not pass' } }
+ .to raise_error(ActionController::ParameterMissing)
+ end
+
context 'with legacy storage' do
it 'moves dependent projects to new namespace' do
project = create(:project_empty_repo, :legacy_storage, namespace: namespace)