forked from github/github-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bugherd_test.rb
33 lines (28 loc) · 871 Bytes
/
bugherd_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class BugherdTest < Service::TestCase
def setup
@stubs = Faraday::Adapter::Test::Stubs.new
end
def test_push
@stubs.post "/custom" do |env|
assert_equal 'www.example.com', env[:url].host
assert_equal 'application/x-www-form-urlencoded',
env[:request_headers]['content-type']
[200, {}, '']
end
svc = service :push,
{'url' => 'http://www.example.com/custom', 'project_key' => 'KEY'}, payload
svc.receive_push
@stubs.post "/github_web_hook/KEY" do |env|
assert_equal 'www.bugherd.com', env[:url].host
assert_equal 'application/x-www-form-urlencoded',
env[:request_headers]['content-type']
[200, {}, '']
end
svc = service :push,
{'url' => '', 'project_key' => 'KEY'}, payload
svc.receive_push
end
def service(*args)
super Service::Bugherd, *args
end
end