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
path: root/spec
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2015-12-07 17:43:13 +0300
committerValery Sizov <valery@gitlab.com>2015-12-07 17:43:13 +0300
commitbd5fb1b479f29df3c2150b6c375c1b7bffd28931 (patch)
tree6786dc0077d83a639753723a1ae1fadb0dfba257 /spec
parente88fd58671f5407d80fafe1070d48b750b9f2e50 (diff)
parent3c97cbc74cf87856ed7b1af197358d4e3adb1240 (diff)
Merge branch 'webhook_payload_with_changes' into 'master'
Add added, modified and removed properties to commit object in webhook https://gitlab.com/gitlab-org/gitlab-ee/issues/20 See merge request !1988
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/push_data_builder_spec.rb9
-rw-r--r--spec/models/commit_spec.rb11
2 files changed, 14 insertions, 6 deletions
diff --git a/spec/lib/gitlab/push_data_builder_spec.rb b/spec/lib/gitlab/push_data_builder_spec.rb
index 02710742625..2170399ab5c 100644
--- a/spec/lib/gitlab/push_data_builder_spec.rb
+++ b/spec/lib/gitlab/push_data_builder_spec.rb
@@ -17,9 +17,9 @@ describe 'Gitlab::PushDataBuilder' do
it { expect(data[:repository][:git_ssh_url]).to eq(project.ssh_url_to_repo) }
it { expect(data[:repository][:visibility_level]).to eq(project.visibility_level) }
it { expect(data[:total_commits_count]).to eq(3) }
- it { expect(data[:added]).to eq(["gitlab-grack"]) }
- it { expect(data[:modified]).to eq([".gitmodules", "files/ruby/popen.rb", "files/ruby/regex.rb"]) }
- it { expect(data[:removed]).to eq([]) }
+ it { expect(data[:commits].first[:added]).to eq(["gitlab-grack"]) }
+ it { expect(data[:commits].first[:modified]).to eq([".gitmodules"]) }
+ it { expect(data[:commits].first[:removed]).to eq([]) }
end
describe :build do
@@ -38,8 +38,5 @@ describe 'Gitlab::PushDataBuilder' do
it { expect(data[:ref]).to eq('refs/tags/v1.1.0') }
it { expect(data[:commits]).to be_empty }
it { expect(data[:total_commits_count]).to be_zero }
- it { expect(data[:added]).to eq([]) }
- it { expect(data[:modified]).to eq([]) }
- it { expect(data[:removed]).to eq([]) }
end
end
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index 974b52c1833..38a3dc1f4a6 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -107,4 +107,15 @@ eos
# Include the subject in the repository stub.
let(:extra_commits) { [subject] }
end
+
+ describe '#hook_attrs' do
+ let(:data) { commit.hook_attrs(with_changed_files: true) }
+
+ it { expect(data).to be_a(Hash) }
+ it { expect(data[:message]).to include('Add submodule from gitlab.com') }
+ it { expect(data[:timestamp]).to eq('2014-02-27T11:01:38+02:00') }
+ it { expect(data[:added]).to eq(["gitlab-grack"]) }
+ it { expect(data[:modified]).to eq([".gitmodules"]) }
+ it { expect(data[:removed]).to eq([]) }
+ end
end