Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request github#697 from halfdan/master
Browse files Browse the repository at this point in the history
Fix failing test for PiwikPlugins hook
  • Loading branch information
kdaigle committed Sep 24, 2013
2 parents 84fdd95 + b838980 commit 1182578
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions test/piwik_plugins_test.rb
@@ -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

0 comments on commit 1182578

Please sign in to comment.