forked from github/github-services
/
agile_bench_test.rb
43 lines (36 loc) · 1.03 KB
/
agile_bench_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
34
35
36
37
38
39
40
41
42
require File.expand_path('../helper', __FILE__)
class AgileBenchTest < Service::TestCase
def setup
@stubs = Faraday::Adapter::Test::Stubs.new
end
def test_push
@stubs.post "/services/v1/github" do |env|
assert_equal 'agilebench.com', env[:url].host
assert_equal 'application/json',
env[:request_headers]['Content-type']
[200, {}, '']
end
svc = service({'token' => 'test_token', 'project_id' => '123'},
payload)
svc.receive_push
end
def test_missing_token
@stubs.post "/services/v1/github"
svc = service({'token' => '', 'project_id' => '123'},
payload)
assert_raise Service::ConfigurationError do
svc.receive_push
end
end
def test_missing_project_id
@stubs.post "/services/v1/github"
svc = service({'token' => 'test_token', 'project_id' => ''},
payload)
assert_raise Service::ConfigurationError do
svc.receive_push
end
end
def service(*args)
super Service::AgileBench, *args
end
end