checkr-official 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.travis.yml +16 -0
- data/Gemfile +8 -0
- data/History.txt +4 -0
- data/README.md +58 -0
- data/Rakefile +14 -0
- data/VERSION +1 -0
- data/bin/checkr-console +7 -0
- data/checkr-official.gemspec +28 -0
- data/gemfiles/default-with-activesupport.gemfile +10 -0
- data/gemfiles/json.gemfile +12 -0
- data/gemfiles/yajl.gemfile +12 -0
- data/lib/checkr.rb +241 -0
- data/lib/checkr/api_class.rb +395 -0
- data/lib/checkr/api_list.rb +78 -0
- data/lib/checkr/api_resource.rb +18 -0
- data/lib/checkr/api_singleton.rb +5 -0
- data/lib/checkr/candidate.rb +35 -0
- data/lib/checkr/county_criminal_search.rb +19 -0
- data/lib/checkr/document.rb +13 -0
- data/lib/checkr/document_list.rb +25 -0
- data/lib/checkr/errors/api_connection_error.rb +4 -0
- data/lib/checkr/errors/api_error.rb +10 -0
- data/lib/checkr/errors/authentication_error.rb +4 -0
- data/lib/checkr/errors/checkr_error.rb +20 -0
- data/lib/checkr/errors/invalid_request_error.rb +10 -0
- data/lib/checkr/geo.rb +19 -0
- data/lib/checkr/motor_vehicle_report.rb +31 -0
- data/lib/checkr/national_criminal_search.rb +17 -0
- data/lib/checkr/report.rb +43 -0
- data/lib/checkr/report_list.rb +27 -0
- data/lib/checkr/sex_offender_search.rb +18 -0
- data/lib/checkr/ssn_trace.rb +18 -0
- data/lib/checkr/subscription.rb +27 -0
- data/lib/checkr/terrorist_watchlist_search.rb +17 -0
- data/lib/checkr/util.rb +91 -0
- data/lib/checkr/version.rb +3 -0
- data/mclovin.jpg +0 -0
- data/tasks/api_test.rb +192 -0
- data/test/checkr/api_class_test.rb +426 -0
- data/test/checkr/api_list_test.rb +27 -0
- data/test/checkr/api_resource_test.rb +28 -0
- data/test/checkr/api_singleton_test.rb +12 -0
- data/test/checkr/authentication_test.rb +50 -0
- data/test/checkr/candidate_test.rb +164 -0
- data/test/checkr/county_criminal_search_test.rb +82 -0
- data/test/checkr/document_test.rb +90 -0
- data/test/checkr/geo_test.rb +73 -0
- data/test/checkr/motor_vehicle_report_test.rb +130 -0
- data/test/checkr/national_criminal_search_test.rb +74 -0
- data/test/checkr/report_test.rb +124 -0
- data/test/checkr/sex_offender_search_test.rb +75 -0
- data/test/checkr/ssn_trace_test.rb +78 -0
- data/test/checkr/status_codes_test.rb +63 -0
- data/test/checkr/subscription_test.rb +96 -0
- data/test/checkr/terrorist_watchlist_search_test.rb +74 -0
- data/test/checkr/util_test.rb +50 -0
- data/test/mock_resource.rb +88 -0
- data/test/test_data.rb +413 -0
- data/test/test_helper.rb +43 -0
- metadata +230 -0
data/test/test_data.rb
ADDED
@@ -0,0 +1,413 @@
|
|
1
|
+
module Checkr
|
2
|
+
module TestData
|
3
|
+
|
4
|
+
def test_response(body, code=200)
|
5
|
+
# When an exception is raised, restclient clobbers method_missing. Hence we
|
6
|
+
# can't just use the stubs interface.
|
7
|
+
body = JSON.generate(body) if !(body.kind_of? String)
|
8
|
+
m = mock
|
9
|
+
m.instance_variable_set('@checkr_values', { :body => body, :code => code })
|
10
|
+
def m.body; @checkr_values[:body]; end
|
11
|
+
def m.code; @checkr_values[:code]; end
|
12
|
+
m
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_mock_resource
|
16
|
+
{
|
17
|
+
:object => 'mock_resource',
|
18
|
+
:name => 'test mr name',
|
19
|
+
:nested => {
|
20
|
+
:id => 'test_nested_id',
|
21
|
+
:object => 'nested_resource',
|
22
|
+
:price => 500
|
23
|
+
},
|
24
|
+
:nested_alt_id => 'nested_alt_id',
|
25
|
+
:nested_with => {
|
26
|
+
:id => 'nested_with_id',
|
27
|
+
:price => 500
|
28
|
+
},
|
29
|
+
:thash => { :some_key => "some value" },
|
30
|
+
:tarray => ["abc", "xyz"],
|
31
|
+
:id => 'test_mock_resource_id'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_mock_resource_list
|
36
|
+
{
|
37
|
+
:object => 'list',
|
38
|
+
:data => [test_mock_resource, test_mock_resource, test_mock_resource],
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
def test_candidate
|
44
|
+
{:id=>"e44aa283528e6fde7d542194",
|
45
|
+
:object=>"candidate",
|
46
|
+
:uri=>"/v1/candidates/e44aa283528e6fde7d542194",
|
47
|
+
:created_at=>"2014-01-18T12:34:00Z",
|
48
|
+
:first_name=>"John",
|
49
|
+
:middle_name=>"Alfred",
|
50
|
+
:last_name=>"Smith",
|
51
|
+
:email=>"john.smith@gmail.com",
|
52
|
+
:phone=>"5555555555",
|
53
|
+
:zipcode=>"90401",
|
54
|
+
:dob=>"1970-01-22",
|
55
|
+
:ssn=>"XXX-XX-4645",
|
56
|
+
:driver_license_number=>"F211165",
|
57
|
+
:driver_license_state=>"CA",
|
58
|
+
:previous_driver_license_number=>"F1501739",
|
59
|
+
:previous_driver_license_state=>"CA",
|
60
|
+
:copy_requested=>false,
|
61
|
+
:adjudication=>nil,
|
62
|
+
:custom_id=>nil,
|
63
|
+
:report_ids=>["532e71cfe88a1d4e8d00000d"],
|
64
|
+
:geo_ids=>["79f943e212cce7de21c054a8", "7299c2c22ebb19abb0688a6c"]}
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_candidate_list
|
68
|
+
{
|
69
|
+
:object => 'list',
|
70
|
+
:data => [test_candidate, test_candidate, test_candidate],
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_report
|
75
|
+
{:id=>"4722c07dd9a10c3985ae432a",
|
76
|
+
:object=>"report",
|
77
|
+
:uri=>"/v1/reports/4722c07dd9a10c3985ae432a",
|
78
|
+
:status=>"clear",
|
79
|
+
:created_at=>"2014-01-18T12:34:00Z",
|
80
|
+
:completed_at=>"2014-01-18T12:35:30Z",
|
81
|
+
:turnaround_time=>90,
|
82
|
+
:package=>"driver_plus",
|
83
|
+
:candidate_id=>"e44aa283528e6fde7d542194",
|
84
|
+
:ssn_trace_id=>"539fd88c101897f7cd000001",
|
85
|
+
:sex_offender_search_id=>"539fd88c101897f7cd000008",
|
86
|
+
:national_criminal_search_id=>"539fd88c101897f7cd000006",
|
87
|
+
:county_criminal_search_ids=>
|
88
|
+
["539fdcf335644a0ef4000001", "532e71cfe88a1d4e8d00000i"],
|
89
|
+
:motor_vehicle_report_id=>"539fd88c101897f7cd000007"}
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_report_list
|
93
|
+
{
|
94
|
+
:object => 'list',
|
95
|
+
:data => [test_report, test_report, test_report],
|
96
|
+
}
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_subscription
|
100
|
+
{:id=>"4722c07dd9a10c3985ae432a",
|
101
|
+
:object=>"subscription",
|
102
|
+
:uri=>"/v1/subscriptions/4722c07dd9a10c3985ae432a",
|
103
|
+
:status=>"active",
|
104
|
+
:created_at=>"2014-01-18T12:34:00Z",
|
105
|
+
:canceled_at=>nil,
|
106
|
+
:package=>"driver_plus",
|
107
|
+
:interval_count=>1,
|
108
|
+
:interval_unit=>"month",
|
109
|
+
:start_date=>"2014-06-10",
|
110
|
+
:candidate_id=>"e44aa283528e6fde7d542194"}
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_geo
|
114
|
+
{:id=>"e44aa283528e6fde7d542194",
|
115
|
+
:object=>"geo",
|
116
|
+
:uri=>"/v1/geos/e44aa283528e6fde7d542194",
|
117
|
+
:created_at=>"2015-01-18T12:34:00Z",
|
118
|
+
:name=>"San Francisco",
|
119
|
+
:state=>"CA"}
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_ssn_trace
|
123
|
+
{:id=>"539fd88c101897f7cd000001",
|
124
|
+
:object=>"ssn_trace",
|
125
|
+
:uri=>"/v1/ssn_traces/539fd88c101897f7cd000001",
|
126
|
+
:status=>"clear",
|
127
|
+
:created_at=>"2014-01-18T12:34:00Z",
|
128
|
+
:completed_at=>"2014-01-18T12:35:30Z",
|
129
|
+
:turnaround_time=>90,
|
130
|
+
:ssn=>"XXX-XX-4645",
|
131
|
+
:addresses=>
|
132
|
+
[{:street=>"123 S Folsom St",
|
133
|
+
:unit=>"Apt 54B",
|
134
|
+
:city=>"San Francisco",
|
135
|
+
:state=>"CA",
|
136
|
+
:zipcode=>"94110",
|
137
|
+
:county=>"SAN FRANCISCO",
|
138
|
+
:from_date=>"2010-05-01",
|
139
|
+
:to_date=>"2014-06-01"},
|
140
|
+
{:street=>"1230 5th Avenue",
|
141
|
+
:unit=>nil,
|
142
|
+
:city=>"New York",
|
143
|
+
:state=>"NY",
|
144
|
+
:zipcode=>"1005",
|
145
|
+
:county=>"NEW YORK",
|
146
|
+
:from_date=>"2007-07-01",
|
147
|
+
:to_date=>"2010-05-01"}]}
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_sex_offender_search
|
151
|
+
{:id=>"539fd88c101897f7cd000008",
|
152
|
+
:object=>"sex_offender_search",
|
153
|
+
:uri=>"/v1/sex_offender_searches/539fd88c101897f7cd000008",
|
154
|
+
:status=>"consider",
|
155
|
+
:created_at=>"2014-01-18T12:34:00Z",
|
156
|
+
:completed_at=>"2014-01-18T12:35:30Z",
|
157
|
+
:turnaround_time=>90,
|
158
|
+
:records=>
|
159
|
+
[{:registry=>"California",
|
160
|
+
:full_name=>"John Alfred Smith",
|
161
|
+
:age=>44,
|
162
|
+
:address=>
|
163
|
+
{:street=>"123 S Folsom St",
|
164
|
+
:city=>"San Francisco",
|
165
|
+
:state=>"CA",
|
166
|
+
:zipcode=>"94110"},
|
167
|
+
:race=>"white",
|
168
|
+
:gender=>"male",
|
169
|
+
:eye_color=>"brown",
|
170
|
+
:hair_color=>"brown",
|
171
|
+
:height=>70,
|
172
|
+
:weight=>175,
|
173
|
+
:registration_start=>"2011-02-12",
|
174
|
+
:registration_end=>"life registration",
|
175
|
+
:photo=>"http://goo.gl/wk4X6f",
|
176
|
+
:additional_info=>nil,
|
177
|
+
:charges=>
|
178
|
+
[{:charge=>"Sexual Assault Statute: 948.02(2)",
|
179
|
+
:victim=>"Child",
|
180
|
+
:classification=>nil,
|
181
|
+
:disposition=>"Guilty",
|
182
|
+
:deposition_date=>"2010-12-22"}]}]}
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_terrorist_watchlist_search
|
186
|
+
{:id=>"539fd88c101897f7cd000008",
|
187
|
+
:object=>"terrorist_watchlist_search",
|
188
|
+
:uri=>"/v1/terrorist_watchlist_searches/539fd88c101897f7cd000008",
|
189
|
+
:status=>"consider",
|
190
|
+
:created_at=>"2014-01-18T12:34:00Z",
|
191
|
+
:completed_at=>"2014-01-18T12:35:30Z",
|
192
|
+
:turnaround_time=>90,
|
193
|
+
:records=>
|
194
|
+
[{:case_number=>"24323-DA",
|
195
|
+
:file_date=>nil,
|
196
|
+
:arresting_agency=>"DEA Boston Division",
|
197
|
+
:court_jurisdiction=>nil,
|
198
|
+
:court_of_record=>nil,
|
199
|
+
:dob=>"1970-01-22",
|
200
|
+
:full_name=>"John Alfred Smith",
|
201
|
+
:additional_info=>nil,
|
202
|
+
:charges=>
|
203
|
+
[{:charge=>"RICO murder",
|
204
|
+
:charge_type=>nil,
|
205
|
+
:charge_id=>nil,
|
206
|
+
:classification=>"Felony",
|
207
|
+
:deposition=>nil,
|
208
|
+
:defendant=>nil,
|
209
|
+
:plaintiff=>nil,
|
210
|
+
:sentence=>"Active Punishment Minimum: 10Y",
|
211
|
+
:disposition=>"Guilty",
|
212
|
+
:notes=>nil,
|
213
|
+
:probation_status=>nil,
|
214
|
+
:offense_date=>"2011-04-22",
|
215
|
+
:deposition_date=>"2014-05-27",
|
216
|
+
:arrest_date=>nil,
|
217
|
+
:charge_date=>nil,
|
218
|
+
:sentence_date=>nil,
|
219
|
+
:disposition_date=>"2011-06-02",
|
220
|
+
:additional_info=>nil}]}]}
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_national_criminal_search
|
224
|
+
{:id=>"539fd88c101897f7cd000006",
|
225
|
+
:object=>"national_criminal_search",
|
226
|
+
:uri=>"/v1/national_criminal_searches/539fd88c101897f7cd000006",
|
227
|
+
:status=>"consider",
|
228
|
+
:created_at=>"2014-01-18T12:34:00Z",
|
229
|
+
:completed_at=>"2014-01-18T12:35:30Z",
|
230
|
+
:turnaround_time=>90,
|
231
|
+
:records=>
|
232
|
+
[{:case_number=>"24323-DA",
|
233
|
+
:file_date=>nil,
|
234
|
+
:arresting_agency=>nil,
|
235
|
+
:court_jurisdiction=>nil,
|
236
|
+
:court_of_record=>nil,
|
237
|
+
:dob=>"1970-01-22",
|
238
|
+
:full_name=>"John Alfred Smith",
|
239
|
+
:additional_info=>nil,
|
240
|
+
:charges=>
|
241
|
+
[{:charge=>"Sell Cocaine",
|
242
|
+
:charge_type=>nil,
|
243
|
+
:charge_id=>nil,
|
244
|
+
:classification=>"Felony",
|
245
|
+
:deposition=>nil,
|
246
|
+
:defendant=>nil,
|
247
|
+
:plaintiff=>nil,
|
248
|
+
:sentence=>"Active Punishment Minimum: 10M",
|
249
|
+
:disposition=>"Guilty",
|
250
|
+
:notes=>"CREDIT FOR TIME SERVED: 41D DA",
|
251
|
+
:probation_status=>nil,
|
252
|
+
:offense_date=>"2011-04-22",
|
253
|
+
:deposition_date=>"2014-05-27",
|
254
|
+
:arrest_date=>nil,
|
255
|
+
:charge_date=>nil,
|
256
|
+
:sentence_date=>nil,
|
257
|
+
:disposition_date=>"2011-06-02",
|
258
|
+
:additional_info=>nil}]}]}
|
259
|
+
end
|
260
|
+
|
261
|
+
def test_county_criminal_search
|
262
|
+
{:id=>"539fdcf335644a0ef4000001",
|
263
|
+
:object=>"county_criminal_search",
|
264
|
+
:uri=>"/v1/county_criminal_searches/539fdcf335644a0ef4000001",
|
265
|
+
:status=>"consider",
|
266
|
+
:created_at=>"2014-01-18T12:34:00Z",
|
267
|
+
:completed_at=>"2014-01-18T12:35:30Z",
|
268
|
+
:turnaround_time=>100800,
|
269
|
+
:county=>"SAN FRANCISCO",
|
270
|
+
:state=>"CA",
|
271
|
+
:records=>
|
272
|
+
[{:case_number=>"24323-DA",
|
273
|
+
:file_date=>"2010-02-18",
|
274
|
+
:arresting_agency=>"San Francisco Police Department",
|
275
|
+
:court_jurisdiction=>"San Francisco",
|
276
|
+
:court_of_record=>nil,
|
277
|
+
:dob=>"1970-01-22",
|
278
|
+
:full_name=>"John Alfred Smith",
|
279
|
+
:additional_info=>nil,
|
280
|
+
:charges=>
|
281
|
+
[{:charge=>"Sell Cocaine",
|
282
|
+
:charge_type=>nil,
|
283
|
+
:charge_id=>nil,
|
284
|
+
:classification=>"Felony",
|
285
|
+
:deposition=>nil,
|
286
|
+
:defendant=>"John Alfred Smith",
|
287
|
+
:plaintiff=>nil,
|
288
|
+
:sentence=>"Active Punishment Minimum: 10M",
|
289
|
+
:disposition=>"Guilty",
|
290
|
+
:notes=>"CREDIT FOR TIME SERVED: 41D DA",
|
291
|
+
:probation_status=>nil,
|
292
|
+
:offense_date=>"2011-04-22",
|
293
|
+
:deposition_date=>"2014-05-27",
|
294
|
+
:arrest_date=>"2011-04-22",
|
295
|
+
:charge_date=>nil,
|
296
|
+
:sentence_date=>"2011-06-02",
|
297
|
+
:disposition_date=>"2011-06-02",
|
298
|
+
:additional_info=>nil}]}]}
|
299
|
+
end
|
300
|
+
|
301
|
+
def test_motor_vehicle_report
|
302
|
+
{:id=>"539fd88c101897f7cd000007",
|
303
|
+
:object=>"motor_vehicle_report",
|
304
|
+
:uri=>"/v1/motor_vehicle_reports/539fd88c101897f7cd000007",
|
305
|
+
:status=>"consider",
|
306
|
+
:created_at=>"2014-01-18T12:34:00Z",
|
307
|
+
:completed_at=>"2014-01-18T12:35:30Z",
|
308
|
+
:turnaround_time=>90,
|
309
|
+
:full_name=>"John Alfred Smith",
|
310
|
+
:license_number=>"F2111132",
|
311
|
+
:license_state=>"CA",
|
312
|
+
:license_status=>"valid",
|
313
|
+
:license_type=>"non-commercial",
|
314
|
+
:license_class=>"C",
|
315
|
+
:expiration_date=>"2016-07-24",
|
316
|
+
:issued_date=>"2006-12-03",
|
317
|
+
:first_issued_date=>"2000-01-14",
|
318
|
+
:inferred_issued_date=>nil,
|
319
|
+
:restrictions=>nil,
|
320
|
+
:accidents=>
|
321
|
+
[{:accident_date=>"2009-04-12",
|
322
|
+
:description=>"property damage",
|
323
|
+
:city=>nil,
|
324
|
+
:county=>"SAN FRANCISCO",
|
325
|
+
:state=>nil,
|
326
|
+
:order_number=>"33-435932",
|
327
|
+
:points=>nil,
|
328
|
+
:vehicle_speed=>nil,
|
329
|
+
:reinstatement_date=>nil,
|
330
|
+
:action_taken=>"police report filed",
|
331
|
+
:ticket_number=>nil,
|
332
|
+
:enforcing_agency=>"San Francisco PD",
|
333
|
+
:jurisdiction=>nil,
|
334
|
+
:severity=>nil,
|
335
|
+
:violation_number=>nil,
|
336
|
+
:license_plate=>"6UM6938",
|
337
|
+
:fine_amount=>nil,
|
338
|
+
:acd_code=>nil,
|
339
|
+
:state_code=>nil,
|
340
|
+
:additional_info=>nil,
|
341
|
+
:injury_accident=>false,
|
342
|
+
:fatality_accident=>false,
|
343
|
+
:fatality_count=>0,
|
344
|
+
:injury_count=>0,
|
345
|
+
:vehicles_involved_count=>1,
|
346
|
+
:report_number=>nil,
|
347
|
+
:policy_number=>nil}],
|
348
|
+
:violations=>
|
349
|
+
[{:type=>"conviction",
|
350
|
+
:issued_date=>"2011-11-14",
|
351
|
+
:conviction_date=>"2010-04-11",
|
352
|
+
:description=>"speeding 15-19 mph",
|
353
|
+
:points=>0,
|
354
|
+
:city=>nil,
|
355
|
+
:county=>"SANTA CLARA",
|
356
|
+
:state=>"California",
|
357
|
+
:ticket_number=>"2D55555",
|
358
|
+
:disposition=>nil,
|
359
|
+
:category=>nil,
|
360
|
+
:avd_category_id=>nil,
|
361
|
+
:court_name=>nil,
|
362
|
+
:acd_code=>nil,
|
363
|
+
:state_code=>nil,
|
364
|
+
:docket=>nil,
|
365
|
+
:additional_info=>nil}]}
|
366
|
+
end
|
367
|
+
|
368
|
+
def test_document
|
369
|
+
{:id=>"4722c07dd9a10c3985ae432a",
|
370
|
+
:object=>"document",
|
371
|
+
:created_at=>"2015-02-11T20:01:50Z",
|
372
|
+
:download_uri=>"https://checkr-documents.checkr.com/download_path",
|
373
|
+
:filesize=>8576,
|
374
|
+
:filename=>"1423684910_candidate_driver_license.jpg",
|
375
|
+
:content_type=>"image/jpeg"}
|
376
|
+
end
|
377
|
+
def test_document_list
|
378
|
+
{
|
379
|
+
:object => 'list',
|
380
|
+
:data => [test_document, test_document, test_document],
|
381
|
+
}
|
382
|
+
end
|
383
|
+
|
384
|
+
# Errors
|
385
|
+
def test_api_error
|
386
|
+
{
|
387
|
+
:error => {
|
388
|
+
:type => "api_error"
|
389
|
+
}
|
390
|
+
}
|
391
|
+
end
|
392
|
+
|
393
|
+
def test_invalid_api_key_error
|
394
|
+
{
|
395
|
+
:error => {
|
396
|
+
:type => "invalid_request_error",
|
397
|
+
:message => "Invalid API Key provided: invalid"
|
398
|
+
}
|
399
|
+
}
|
400
|
+
end
|
401
|
+
|
402
|
+
def test_missing_id_error
|
403
|
+
{
|
404
|
+
:error => {
|
405
|
+
:param => "id",
|
406
|
+
:type => "invalid_request_error",
|
407
|
+
:message => "Missing id"
|
408
|
+
}
|
409
|
+
}
|
410
|
+
end
|
411
|
+
|
412
|
+
end
|
413
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'checkr'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'mocha/setup'
|
4
|
+
require 'stringio'
|
5
|
+
require 'shoulda'
|
6
|
+
require File.expand_path('../test_data', __FILE__)
|
7
|
+
require File.expand_path('../mock_resource', __FILE__)
|
8
|
+
|
9
|
+
# monkeypatch request methods
|
10
|
+
module Checkr
|
11
|
+
@mock_rest_client = nil
|
12
|
+
|
13
|
+
def self.mock_rest_client=(mock_client)
|
14
|
+
@mock_rest_client = mock_client
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.execute_request(opts)
|
18
|
+
headers = opts[:headers]
|
19
|
+
post_params = opts[:payload]
|
20
|
+
case opts[:method]
|
21
|
+
when :get then @mock_rest_client.get opts[:url], headers, post_params
|
22
|
+
when :put then @mock_rest_client.put opts[:url], headers, post_params
|
23
|
+
when :post then @mock_rest_client.post opts[:url], headers, post_params
|
24
|
+
when :delete then @mock_rest_client.delete opts[:url], headers, post_params
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class Test::Unit::TestCase
|
30
|
+
include Checkr::TestData
|
31
|
+
include Mocha
|
32
|
+
|
33
|
+
setup do
|
34
|
+
@mock = mock
|
35
|
+
Checkr.mock_rest_client = @mock
|
36
|
+
Checkr.api_key="foo"
|
37
|
+
end
|
38
|
+
|
39
|
+
teardown do
|
40
|
+
Checkr.mock_rest_client = nil
|
41
|
+
Checkr.api_key=nil
|
42
|
+
end
|
43
|
+
end
|