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

Skip to content
This repository was archived by the owner on Jan 31, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion lib/services/tender.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
class Service::Tender < Service
# mysite.tenderapp.com
string :domain

# tracker token. can be found here:
# http://mysite.tenderapp.com/settings/trackers
password :token
default_events :issues

default_events :issues, :pull_request

url 'https://tenderapp.com'
logo_url 'https://tenderapp.com/images/logo.jpg'

# julien on http://help.tenderapp.com/home
maintained_by :github => 'calexicoz'

# Support channels for user-level Hook problems (service failure, misconfigured)
supported_by :web => 'http://help.tenderapp.com/home',
:email => '[email protected]'

def receive_issues
raise_config_error 'Missing token' if data['token'].to_s.empty?
Expand Down
24 changes: 24 additions & 0 deletions test/tender_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,31 @@ def test_issues
service(:issues, @options, issues_payload).receive_issues
end

def test_pull
@stubs.post "/tickets/github/Aewi5ui1" do |env|
puts env[:body]
body = JSON.parse(env[:body])

assert_equal 'https', env[:url].scheme
assert !env[:ssl][:verify]
assert_equal 'some.tenderapp.com', env[:url].host
assert_equal 'application/json', env[:request_headers]['Content-Type']

assert_equal body["pull_request"]["state"], "open"
assert_equal body["pull_request"]["number"], 5
assert_equal body["repository"]["name"], "grit"
assert_equal body["repository"]["owner"]["login"], "mojombo"

[200, {}, '']
end

service(:pull_request, @options, pull_payload).receive_pull_request
end

private

def service(*args)
super Service::Tender, *args
end

end