Skip to content

Instantly share code, notes, and snippets.

@jorilallo
Created February 9, 2012 17:28
Show Gist options
  • Select an option

  • Save jorilallo/1781415 to your computer and use it in GitHub Desktop.

Select an option

Save jorilallo/1781415 to your computer and use it in GitHub Desktop.
class Service::Grove < Service
string :channel_token
def receive_push
raise_config_error "Missing channel token" if data['channel_token'].to_s.empty?
token = data['channel_token'].to_s
res = http_post "https://grove.io/api/services/github/#{token}",
:payload => JSON.generate(payload)
end
end
require File.expand_path('../helper', __FILE__)
class GroveTest < Service::TestCase
def setup
@stubs = Faraday::Adapter::Test::Stubs.new
@channel_token = "test_token"
end
def test_push
@stubs.post "/api/services/github/#{@channel_token}" do |env|
assert_equal 'grove.io', env[:url].host
[200, {}, '']
end
svc = service(
{'channel_token' => 'test_token'}, payload)
svc.receive_push
end
def service(*args)
super Service::Grove, *args
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment