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:
authorJungkook Park <pjknkda@gmail.com>2015-09-11 06:42:14 +0300
committerJungkook Park <pjknkda@gmail.com>2015-09-16 23:33:37 +0300
commite4ac2d582c729cc22e0da7ab894be04a187eb006 (patch)
tree41202506fdca6dc4f2888b37cf5e2ba505092b6e /spec/models
parentcac969229aab74ab5dcd7682c4f1c3a74a17b9d6 (diff)
add repository field to issue hook data
add a test for to_hook_data of issue model update CHANGELOG
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/concerns/issuable_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb
index b6d80451d2e..8f706f8934b 100644
--- a/spec/models/concerns/issuable_spec.rb
+++ b/spec/models/concerns/issuable_spec.rb
@@ -2,6 +2,7 @@ require 'spec_helper'
describe Issue, "Issuable" do
let(:issue) { create(:issue) }
+ let(:user) { create(:user) }
describe "Associations" do
it { is_expected.to belong_to(:project) }
@@ -66,4 +67,19 @@ describe Issue, "Issuable" do
expect(issue.new?).to be_falsey
end
end
+
+
+ describe "#to_hook_data" do
+ let(:hook_data) { issue.to_hook_data(user) }
+
+ it "returns correct hook data" do
+ expect(hook_data[:object_kind]).to eq("issue")
+ expect(hook_data[:user]).to eq(user.hook_attrs)
+ expect(hook_data[:repository][:name]).to eq(issue.project.name)
+ expect(hook_data[:repository][:url]).to eq(issue.project.url_to_repo)
+ expect(hook_data[:repository][:description]).to eq(issue.project.description)
+ expect(hook_data[:repository][:homepage]).to eq(issue.project.web_url)
+ expect(hook_data[:object_attributes]).to eq(issue.hook_attrs)
+ end
+ end
end