This repository was archived by the owner on Jan 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathhelper.rb
More file actions
101 lines (78 loc) · 1.97 KB
/
Copy pathhelper.rb
File metadata and controls
101 lines (78 loc) · 1.97 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
require 'minitest/autorun'
require 'minitest/unit'
require 'pp'
require File.expand_path('../../config/load', __FILE__)
Service.load_services
class Service::TestCase < Minitest::Test
ALL_SERVICES = Service.services.dup
def test_default
end
def assert_nothing_raised(*)
yield
end
def service(klass, event_or_data, data, payload=nil)
event = nil
if event_or_data.is_a?(Symbol)
event = event_or_data
else
payload = data
data = event_or_data
event = :push
end
service = klass.new(event, data, payload)
service.http :adapter => [:test, @stubs]
service.delivery_guid = "guid-#{rand}"
service
end
def basic_auth(user, pass)
"Basic " + ["#{user}:#{pass}"].pack("m*").strip
end
def push_payload
Service::PushHelpers.sample_payload
end
alias payload push_payload
def pull_payload
Service::PullRequestHelpers.sample_payload
end
def pull_request_payload
Service::PullRequestHelpers.sample_payload
end
def pull_request_review_comment_payload
Service::PullRequestReviewCommentHelpers.sample_payload
end
def issues_payload
Service::IssueHelpers.sample_payload
end
def issue_comment_payload
Service::IssueCommentHelpers.sample_payload
end
def commit_comment_payload
Service::CommitCommentHelpers.sample_payload
end
def public_payload
Service::PublicHelpers.sample_payload
end
def gollum_payload
Service::GollumHelpers.sample_payload
end
def basic_payload
Service::HelpersWithMeta.sample_payload
end
def deployment_payload
Service::DeploymentHelpers.sample_deployment_payload
end
def status_payload
Service::StatusHelpers.sample_status_payload
end
end
module Service::HttpTestMethods
def setup
@stubs = Faraday::Adapter::Test::Stubs.new
end
def service(event_or_data, data, payload = nil)
super(service_class, event_or_data, data, payload)
end
def service_class
raise NotImplementedError
end
end