This repository has been archived by the owner on May 9, 2022. It is now read-only.
forked from github/github-services
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request github#697 from halfdan/master
Fix failing test for PiwikPlugins hook
- Loading branch information
Showing
1 changed file
with
7 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
require File.expand_path('../helper', __FILE__) | ||
|
||
class PiwikPluginsTest < Service::TestCase | ||
def setup | ||
@stubs = Faraday::Adapter::Test::Stubs.new | ||
end | ||
include Service::HttpTestMethods | ||
|
||
def test_push | ||
svc = service :push, {}, 'a' => 1 | ||
svc = service({}, 'a' => 1) | ||
|
||
@stubs.post "/postreceive-hook" do |env| | ||
body = JSON.parse(env[:body]) | ||
assert_equal 'plugins.piwik.org', env[:url].host | ||
data = Faraday::Utils.parse_nested_query(env[:body]) | ||
assert_equal 1, JSON.parse(data['payload'])['a'] | ||
assert_equal 1, body['payload']['a'] | ||
[200, {}, ''] | ||
end | ||
|
||
svc.receive | ||
svc.receive_push | ||
|
||
@stubs.verify_stubbed_calls | ||
end | ||
|
||
def service(*args) | ||
super Service::PiwikPlugins, *args | ||
def service_class | ||
Service::PiwikPlugins | ||
end | ||
end | ||
|