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

Skip to content

Commit 3923335

Browse files
committed
Merge pull request github#1006 from calexicoz/master
Receive pull requests as well as issues, and add test for it
2 parents 69dd52c + 9fbda63 commit 3923335

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

lib/services/tender.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
class Service::Tender < Service
2+
# mysite.tenderapp.com
23
string :domain
4+
5+
# tracker token. can be found here:
6+
# http://mysite.tenderapp.com/settings/trackers
37
password :token
4-
default_events :issues
8+
9+
default_events :issues, :pull_request
10+
11+
url 'https://tenderapp.com'
12+
logo_url 'https://tenderapp.com/images/logo.jpg'
13+
14+
# julien on http://help.tenderapp.com/home
15+
maintained_by :github => 'calexicoz'
16+
17+
# Support channels for user-level Hook problems (service failure, misconfigured)
18+
supported_by :web => 'http://help.tenderapp.com/home',
19+
:email => '[email protected]'
520

621
def receive_issues
722
raise_config_error 'Missing token' if data['token'].to_s.empty?

test/tender_test.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,31 @@ def test_issues
3030
service(:issues, @options, issues_payload).receive_issues
3131
end
3232

33+
def test_pull
34+
@stubs.post "/tickets/github/Aewi5ui1" do |env|
35+
puts env[:body]
36+
body = JSON.parse(env[:body])
37+
38+
assert_equal 'https', env[:url].scheme
39+
assert !env[:ssl][:verify]
40+
assert_equal 'some.tenderapp.com', env[:url].host
41+
assert_equal 'application/json', env[:request_headers]['Content-Type']
42+
43+
assert_equal body["pull_request"]["state"], "open"
44+
assert_equal body["pull_request"]["number"], 5
45+
assert_equal body["repository"]["name"], "grit"
46+
assert_equal body["repository"]["owner"]["login"], "mojombo"
47+
48+
[200, {}, '']
49+
end
50+
51+
service(:pull_request, @options, pull_payload).receive_pull_request
52+
end
53+
54+
private
55+
3356
def service(*args)
3457
super Service::Tender, *args
3558
end
59+
3660
end

0 commit comments

Comments
 (0)