Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7dd74cb

Browse files
committed
Merge pull request github#895 from anna239/master
Do not fix issue if it was mentioned in commit with no explicit command
2 parents 7fc10c2 + e70a475 commit 7dd74cb

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

lib/services/you_track.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def process_commit(commit)
7676
author ||= find_user_by_email(commit['author']['email'])
7777
return if author.nil?
7878

79-
command = 'Fixed' if command.nil?
79+
command = 'comment' if command.nil?
8080
comment_string = "Commit made by '''" + commit['author']['name'] + "''' on ''" + commit['timestamp'] + "''\n" + commit['url'] + "\n\n{quote}" + commit['message'].to_s + '{quote}'
8181
execute_command(author, issue_id, command, comment_string)
8282
}

test/youtrack_test.rb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,33 @@ def test_push
5757
@stubs.verify_stubbed_calls
5858
end
5959

60+
def test_push_no_command
61+
valid_process_stubs
62+
63+
@stubs.post "/abc/rest/issue/case-2/execute" do |env|
64+
assert_equal 'yt.com', env[:url].host
65+
assert_equal 'sc', env[:request_headers]['Cookie']
66+
assert_equal 'comment', env[:params]['command']
67+
assert_equal 'mojombo', env[:params]['runAs']
68+
[200, {}, '']
69+
end
70+
71+
hash = payload
72+
hash['commits'].first['message'].sub! /Case#1/, '#case-2'
73+
74+
svc = service(@data, hash)
75+
svc.receive_push
76+
77+
@stubs.verify_stubbed_calls
78+
end
79+
6080
def test_branch_match
6181
valid_process_stubs
6282

6383
@stubs.post "/abc/rest/issue/case-2/execute" do |env|
6484
assert_equal 'yt.com', env[:url].host
6585
assert_equal 'sc', env[:request_headers]['Cookie']
66-
assert_equal 'Fixed', env[:params]['command']
86+
assert_equal 'comment', env[:params]['command']
6787
assert_equal 'mojombo', env[:params]['runAs']
6888
[200, {}, '']
6989
end

0 commit comments

Comments
 (0)