summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/hooks_controller_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-28 21:10:45 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-28 21:10:45 +0000
commit71d6b9014bef64436bbd996667e6458ebde561c4 (patch)
tree21b049d24b2d96be84904576e2b619f82d5d515d /spec/controllers/projects/hooks_controller_spec.rb
parent0076bbc67375ff1507e42ce479406daf92c0a6a2 (diff)
downloadgitlab-ce-71d6b9014bef64436bbd996667e6458ebde561c4.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/projects/hooks_controller_spec.rb')
-rw-r--r--spec/controllers/projects/hooks_controller_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/controllers/projects/hooks_controller_spec.rb b/spec/controllers/projects/hooks_controller_spec.rb
index 54c958d6350..dbab3575831 100644
--- a/spec/controllers/projects/hooks_controller_spec.rb
+++ b/spec/controllers/projects/hooks_controller_spec.rb
@@ -29,6 +29,22 @@ RSpec.describe Projects::HooksController do
{ namespace_id: project.namespace, project_id: project, id: hook.id }
end
+ context 'with an existing token' do
+ hook_params = {
+ token: WebHook::SECRET_MASK,
+ url: "http://example.com"
+ }
+
+ it 'does not change a token' do
+ expect do
+ post :update, params: params.merge({ hook: hook_params })
+ end.not_to change { hook.reload.token }
+
+ expect(response).to have_gitlab_http_status(:found)
+ expect(flash[:alert]).to be_blank
+ end
+ end
+
it 'adds, updates and deletes URL variables' do
hook.update!(url_variables: { 'a' => 'bar', 'b' => 'woo' })