Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit cca4a0f

Browse files
committed
Send issues to Pivotal
1 parent acd994d commit cca4a0f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

lib/cc/services/pivotal_tracker.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ def receive_quality
3333
create_story(name, details_url)
3434
end
3535

36+
def receive_issue
37+
title = %{Fix "#{issue["check_name"]}" issue in #{constant_name}}
38+
39+
body = [issue["description"], details_url].join("\n\n")
40+
41+
create_story(title, body)
42+
end
43+
3644
def receive_vulnerability
3745
formatter = CC::Formatters::TicketFormatter.new(self)
3846

test/pivotal_tracker_test.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,23 @@ def test_vulnerability
2323
)
2424
end
2525

26+
def test_issue
27+
payload = {
28+
issue: {
29+
"check_name" => "Style/LongLine",
30+
"description" => "Line is too long [1000/80]"
31+
},
32+
constant_name: "foo.rb",
33+
details_url: "http://example.com/repos/id/foo.rb#issue_123"
34+
}
35+
36+
assert_pivotal_receives(
37+
event(:issue, payload),
38+
"Fix \"Style/LongLine\" issue in foo.rb",
39+
"Line is too long [1000/80]\n\nhttp://example.com/repos/id/foo.rb#issue_123"
40+
)
41+
end
42+
2643
def test_receive_test
2744
@stubs.post 'services/v3/projects/123/stories' do |env|
2845
[200, {}, '<story><id>123</id><url>http://foo.bar</url></story>']

0 commit comments

Comments
 (0)