summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-02-16 13:08:36 +0000
committerDouwe Maan <douwe@gitlab.com>2016-02-16 13:08:36 +0000
commitbbbfdba0b9c0e2d5c463110398f7469821fd4c44 (patch)
tree5f67d316d2304ef2b14e4ea376b84ba30013fc40 /spec/support
parent4ae21313764bb5c446b9b21866c98b04c286abf8 (diff)
parent1de95137906e1b262eeaf2d627469c9a1e47a536 (diff)
downloadgitlab-ce-bbbfdba0b9c0e2d5c463110398f7469821fd4c44.tar.gz
Merge branch 'bugagazavr/gitlab-ce-extend-hooks' into 'master'
Add new data to project in push, issue, merge-request and note webhooks data _Originally opened at !2738 by @bugagazavr._ - - - **What does this MR do?** Adds more data to hooks, makes repository data in all hook more dry ( use one hook_attrs method for repository data in all hooks ) **Are there points in the code the reviewer needs to double check?** 1. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/app/models/project.rb#L738 2. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/app/models/concerns/issuable.rb#L132 3. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/lib/gitlab/push_data_builder.rb#L52 4. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/lib/gitlab/note_data_builder.rb#L56 **Why was this MR needed?** More information about user for push events, and more data about repositiry ( project ) **What are the relevant issue numbers?** No **Screenshots (if relevant)** No See merge request !2788
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/project_hook_data_shared_example.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/support/project_hook_data_shared_example.rb b/spec/support/project_hook_data_shared_example.rb
new file mode 100644
index 00000000000..422083875d7
--- /dev/null
+++ b/spec/support/project_hook_data_shared_example.rb
@@ -0,0 +1,27 @@
+RSpec.shared_examples 'project hook data' do |project_key: :project|
+ it 'contains project data' do
+ expect(data[project_key][:name]).to eq(project.name)
+ expect(data[project_key][:description]).to eq(project.description)
+ expect(data[project_key][:web_url]).to eq(project.web_url)
+ expect(data[project_key][:avatar_url]).to eq(project.avatar_url)
+ expect(data[project_key][:git_http_url]).to eq(project.http_url_to_repo)
+ expect(data[project_key][:git_ssh_url]).to eq(project.ssh_url_to_repo)
+ expect(data[project_key][:namespace]).to eq(project.namespace.name)
+ expect(data[project_key][:visibility_level]).to eq(project.visibility_level)
+ expect(data[project_key][:path_with_namespace]).to eq(project.path_with_namespace)
+ expect(data[project_key][:default_branch]).to eq(project.default_branch)
+ expect(data[project_key][:homepage]).to eq(project.web_url)
+ expect(data[project_key][:url]).to eq(project.url_to_repo)
+ expect(data[project_key][:ssh_url]).to eq(project.ssh_url_to_repo)
+ expect(data[project_key][:http_url]).to eq(project.http_url_to_repo)
+ end
+end
+
+RSpec.shared_examples 'deprecated repository hook data' do |project_key: :project|
+ it 'contains deprecated repository data' do
+ expect(data[:repository][:name]).to eq(project.name)
+ expect(data[:repository][:description]).to eq(project.description)
+ expect(data[:repository][:url]).to eq(project.url_to_repo)
+ expect(data[:repository][:homepage]).to eq(project.web_url)
+ end
+end