Skip to content
Browse files

Merge branch 'master' of github.com:github/github-services

  • Loading branch information...
2 parents 7749de1 + 7827221 commit 483b6737a6713cad1cd1e52fd171a5ac9d5ac478 @technoweenie technoweenie committed
Showing with 7 additions and 4 deletions.
  1. +5 −2 services/appharbor.rb
  2. +2 −2 test/appharbor_test.rb
View
7 services/appharbor.rb
@@ -19,7 +19,7 @@ def receive_push
def post_appharbor_message(slug, token)
return unless commit = distinct_commits.last
- create_build_url = "https://appharbor.com/application/#{slug}/build?authorization=#{token}"
+ create_build_url = "https://appharbor.com/applications/#{slug}/builds"
appharbor_message = {
:branches => {
@@ -31,6 +31,9 @@ def post_appharbor_message(slug, token)
}
}
- http_post create_build_url, appharbor_message.to_json, 'Accept' => 'application/json'
+ http.headers['Accept'] = 'application/json'
+ http.headers['Authorization'] = "BEARER #{token}"
+
+ http_post create_build_url, appharbor_message.to_json
end
end
View
4 test/appharbor_test.rb
@@ -21,7 +21,7 @@ def service(*args)
def test_push(application_slugs, token)
application_slugs.split(",").each do |slug|
- @stubs.post "/application/#{slug}/build" do |env|
+ @stubs.post "/applications/#{slug}/builds" do |env|
verify_appharbor_payload(token, env)
end
end
@@ -33,7 +33,7 @@ def test_push(application_slugs, token)
end
def verify_appharbor_payload(token, env)
- assert_equal token, env[:params]['authorization']
+ assert_equal "BEARER #{token}", env[:request_headers]['authorization']
assert_equal 'application/json', env[:request_headers]['accept']
branches = JSON.parse(env[:body])['branches']

0 comments on commit 483b673

Please sign in to comment.
Something went wrong with that request. Please try again.