Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add service hook for Habitualist

  • Loading branch information...
commit f52ebe6696bebcaf86e0b7163ee529e2072f8456 1 parent ccb3191
@paltman paltman authored
View
4 docs/habitualist
@@ -0,0 +1,4 @@
+Habitualist
+===========
+
+Automatically log commit activity against actions on https://habitualist.com
View
5 services/habitualist.rb
@@ -0,0 +1,5 @@
+class Service::Habitualist < Service
+ def receive_push
+ http_post "https://habitualist.com/webhooks/github/", :payload => JSON.generate(payload)
+ end
+end
View
24 test/habitualist_test.rb
@@ -0,0 +1,24 @@
+require File.expand_path('../helper', __FILE__)
+
+class HabitualistTest < Service::TestCase
+ def setup
+ @stubs = Faraday::Adapter::Test::Stubs.new
+ end
+
+ def test_push
+ @stubs.post "/webhooks/github/" do |env|
+ assert_equal 'habitualist.com', env[:url].host
+ data = Rack::Utils.parse_query(env[:body])
+ assert_equal 1, JSON.parse(data['payload'])['a']
+ [200, {}, '']
+ end
+
+ svc = service({}, :a => 1)
+ svc.receive_push
+ end
+
+ def service(*args)
+ super Service::Habitualist, *args
+ end
+end
+
Please sign in to comment.
Something went wrong with that request. Please try again.