Skip to content
This repository was archived by the owner on Jan 31, 2019. It is now read-only.
Closed
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
27 changes: 27 additions & 0 deletions docs/test_pilot
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
TestPilot CI
======

TestPilot CI is a fully managed distributed Continuous Integration and Deployment Service
for Ruby, Node.js, Clojure, Java, Python, and Scala applications.

Install Notes
-------------

1. Create an account at http://testpilot.me
2. Authorize TestPilot to connect with your Github account.
3. After your repositories have been synced, activate the repository you want to test.
TestPilot will automatically add necessary token above for your project, alternatively you can
find the token under your account page at http://testpilot.me/my/account

4. Check the "Active" checkbox and click "Update Settings".
5. Push some changes to this repository and TestPilot will automatically start your build process.
6. You should receive an email from TestPilot once the build has completed

For more details about TestPilot, go to http://testpilot.me

Developer Notes
---------------

data
- token

4 changes: 2 additions & 2 deletions services/talker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def receive_push
http.headers["X-Talker-Token"] = token
http.url_prefix = data['url']

if data['digest'].to_i == 1 and commits.size > 1
http_post 'messages.json', :message => "#{summary_message} #{summary_url}"
if (data['digest'].to_i == 1 and commits.size > 1)
http_post 'messages.json', :message => "#{summary_message} - #{summary_url}"
else
http_post 'messages.json', :message => "#{pusher_name} pushed the following commits:"
commit_messages.each do |message|
Expand Down
26 changes: 26 additions & 0 deletions services/test_pilot.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class Service::TestPilot < Service
string :token

def receive_push
http.ssl[:verify] = false
http.params.merge!(authentication_param)
http_post test_pilot_url, :payload => payload.to_json
end

def test_pilot_url
"http://testpilot.me/callbacks/github"
end

def token
data['token'].to_s.strip
end

def authentication_param
if token.empty?
raise_config_error "Needs a token"
end

{:token => token}
end
end

53 changes: 53 additions & 0 deletions test/test_pilot_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
require File.expand_path('../helper', __FILE__)

class TestPilotTest < Service::TestCase
def setup
@stubs = Faraday::Adapter::Test::Stubs.new
@svc = service(data, payload)
end

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

def data
{
'token' => 'TOKEN'
}
end

def test_reads_token_from_data
assert_equal "TOKEN", @svc.token
end

def test_constructs_post_receive_url
assert_equal 'http://testpilot.me/callbacks/github',
@svc.test_pilot_url
end

def test_posts_payload
@stubs.post '/callbacks/github' do |env|
assert_equal env[:params]['token'], @svc.token
assert_equal payload, JSON.parse(Rack::Utils.parse_query(env[:body])['payload'])
end
@svc.receive_push
end

def test_it_raises_an_error_if_no_token_is_supplied
data = {'token' => ''}
svc = service(data, payload)
assert_raises Service::ConfigurationError do
svc.receive_push
end
end

def test_strips_whitespace_from_form_values
data = {
'token' => 'TOKEN '
}

svc = service(data, payload)
assert_equal 'TOKEN', svc.token
end
end