summaryrefslogtreecommitdiff
path: root/spec/requests/api/project_hooks_spec.rb
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-10-08 10:40:10 +0100
committerFilipa Lacerda <filipa@gitlab.com>2018-10-08 10:40:10 +0100
commitfa875ba7a9441df6827ef1d6b05405c66ee0c579 (patch)
tree23d0cf911c9bf6a73fec9bb1f3de1bf61bedeacd /spec/requests/api/project_hooks_spec.rb
parentecefe090460687a078e3d1aacf621fd5bff07fb5 (diff)
parent838c1076694d24d180e19625d663749c8b5c1a1c (diff)
downloadgitlab-ce-fa875ba7a9441df6827ef1d6b05405c66ee0c579.tar.gz
Merge branch 'master' into 42611-removed-branch-link
* master: (1252 commits) Render log artifact files in GitLab Check disabled_services when finding a service Fix invalid parent path on group settings page Backport CE changes for: [Frontend only] Batch comments on merge requests Add button to insert table in markdown editor Update GITALY_SERVER_VERSION Updates Laravel.gitlab-ci.yml template Update operations metrics empty state Fix LFS uploaded images not being rendered Prepare admin/projects/show view to allow EE specific feature Add timed incremental rollout to Auto DevOps Update spec comment to point to correct issue Fix documentation for variables Document Security and Licence Management features permissions Fix time dependent jobs spec Use a CTE to remove the query timeout Backport changes from gitlab-ee!7538 Fix CE to EE merge (backport) Add changelog entry Refactor Feature.flipper method ...
Diffstat (limited to 'spec/requests/api/project_hooks_spec.rb')
-rw-r--r--spec/requests/api/project_hooks_spec.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/requests/api/project_hooks_spec.rb b/spec/requests/api/project_hooks_spec.rb
index d3f81cc038d..87997a48dc9 100644
--- a/spec/requests/api/project_hooks_spec.rb
+++ b/spec/requests/api/project_hooks_spec.rb
@@ -9,7 +9,8 @@ describe API::ProjectHooks, 'ProjectHooks' do
:all_events_enabled,
project: project,
url: 'http://example.com',
- enable_ssl_verification: true)
+ enable_ssl_verification: true,
+ push_events_branch_filter: 'master')
end
before do
@@ -38,6 +39,7 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect(json_response.first['pipeline_events']).to eq(true)
expect(json_response.first['wiki_page_events']).to eq(true)
expect(json_response.first['enable_ssl_verification']).to eq(true)
+ expect(json_response.first['push_events_branch_filter']).to eq('master')
end
end
@@ -90,7 +92,7 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect do
post api("/projects/#{project.id}/hooks", user),
url: "http://example.com", issues_events: true, confidential_issues_events: true, wiki_page_events: true,
- job_events: true
+ job_events: true, push_events_branch_filter: 'some-feature-branch'
end.to change {project.hooks.count}.by(1)
expect(response).to have_gitlab_http_status(201)
@@ -106,6 +108,7 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect(json_response['pipeline_events']).to eq(false)
expect(json_response['wiki_page_events']).to eq(true)
expect(json_response['enable_ssl_verification']).to eq(true)
+ expect(json_response['push_events_branch_filter']).to eq('some-feature-branch')
expect(json_response).not_to include('token')
end
@@ -132,7 +135,12 @@ describe API::ProjectHooks, 'ProjectHooks' do
end
it "returns a 422 error if url not valid" do
- post api("/projects/#{project.id}/hooks", user), "url" => "ftp://example.com"
+ post api("/projects/#{project.id}/hooks", user), url: "ftp://example.com"
+ expect(response).to have_gitlab_http_status(422)
+ end
+
+ it "returns a 422 error if branch filter is not valid" do
+ post api("/projects/#{project.id}/hooks", user), url: "http://example.com", push_events_branch_filter: '~badbranchname/'
expect(response).to have_gitlab_http_status(422)
end
end