checkr-official 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,73 @@
|
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Checkr
|
4
|
+
class GeoTest < Test::Unit::TestCase
|
5
|
+
setup do
|
6
|
+
@geo_url = "#{Checkr.api_base}/v1/geos"
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'Geo class' do
|
10
|
+
should 'be retrieveable' do
|
11
|
+
id = "geo_id"
|
12
|
+
@mock.expects(:get).once.with("#{@geo_url}/#{id}", anything, anything).returns(test_response(test_geo))
|
13
|
+
geo = Geo.retrieve(id)
|
14
|
+
assert(geo.is_a?(Geo))
|
15
|
+
end
|
16
|
+
|
17
|
+
should 'be createable' do
|
18
|
+
@mock.expects(:post).once.with(@geo_url, anything, test_geo).returns(test_response(test_geo))
|
19
|
+
geo = Geo.create(test_geo)
|
20
|
+
assert(geo.is_a?(Geo))
|
21
|
+
assert_equal(test_geo[:id], geo.id)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'Geo instance' do
|
26
|
+
should 'be refreshable' do
|
27
|
+
@mock.expects(:get).once.with("#{@geo_url}/#{test_geo[:id]}", anything, anything).returns(test_response(test_geo))
|
28
|
+
geo = Geo.new(test_geo[:id])
|
29
|
+
geo.refresh
|
30
|
+
assert_equal(test_geo[:name], geo.name)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
context 'Retrieved Geo instance' do
|
36
|
+
setup do
|
37
|
+
@mock.expects(:get).once.returns(test_response(test_geo))
|
38
|
+
@geo = Geo.retrieve('geo_id')
|
39
|
+
end
|
40
|
+
|
41
|
+
should 'have the id attribute' do
|
42
|
+
assert_equal(test_geo[:id], @geo.id)
|
43
|
+
end
|
44
|
+
|
45
|
+
should 'have the object attribute' do
|
46
|
+
assert_equal(test_geo[:object], @geo.object)
|
47
|
+
end
|
48
|
+
|
49
|
+
should 'have the uri attribute' do
|
50
|
+
assert_equal(test_geo[:uri], @geo.uri)
|
51
|
+
end
|
52
|
+
|
53
|
+
should 'have the created_at attribute' do
|
54
|
+
assert_equal(test_geo[:created_at], @geo.created_at)
|
55
|
+
end
|
56
|
+
|
57
|
+
should 'have the name attribute' do
|
58
|
+
assert_equal(test_geo[:name], @geo.name)
|
59
|
+
end
|
60
|
+
|
61
|
+
should 'have the state attribute' do
|
62
|
+
assert_equal(test_geo[:state], @geo.state)
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
should 'be registered' do
|
68
|
+
assert(APIClass.subclasses.include?(Geo))
|
69
|
+
assert_equal(Geo, APIClass.subclass_fetch("geo"))
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Checkr
|
4
|
+
class MotorVehicleReportTest < Test::Unit::TestCase
|
5
|
+
setup do
|
6
|
+
@motor_vehicle_report_url = "#{Checkr.api_base}/v1/motor_vehicle_reports"
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'MotorVehicleReport class' do
|
10
|
+
should 'be retrieveable' do
|
11
|
+
id = "motor_vehicle_report_id"
|
12
|
+
@mock.expects(:get).once.with("#{@motor_vehicle_report_url}/#{id}", anything, anything).returns(test_response(test_motor_vehicle_report))
|
13
|
+
motor_vehicle_report = MotorVehicleReport.retrieve(id)
|
14
|
+
assert(motor_vehicle_report.is_a?(MotorVehicleReport))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'MotorVehicleReport instance' do
|
19
|
+
should 'be refreshable' do
|
20
|
+
@mock.expects(:get).once.with("#{@motor_vehicle_report_url}/#{test_motor_vehicle_report[:id]}", anything, anything).returns(test_response(test_motor_vehicle_report))
|
21
|
+
motor_vehicle_report = MotorVehicleReport.new(test_motor_vehicle_report[:id])
|
22
|
+
motor_vehicle_report.refresh
|
23
|
+
assert_equal(test_motor_vehicle_report[:status], motor_vehicle_report.status)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
context 'Retrieved MotorVehicleReport instance' do
|
29
|
+
setup do
|
30
|
+
@mock.expects(:get).once.returns(test_response(test_motor_vehicle_report))
|
31
|
+
@motor_vehicle_report = MotorVehicleReport.retrieve('motor_vehicle_report_id')
|
32
|
+
end
|
33
|
+
|
34
|
+
should 'have the id attribute' do
|
35
|
+
assert_equal(test_motor_vehicle_report[:id], @motor_vehicle_report.id)
|
36
|
+
end
|
37
|
+
|
38
|
+
should 'have the object attribute' do
|
39
|
+
assert_equal(test_motor_vehicle_report[:object], @motor_vehicle_report.object)
|
40
|
+
end
|
41
|
+
|
42
|
+
should 'have the uri attribute' do
|
43
|
+
assert_equal(test_motor_vehicle_report[:uri], @motor_vehicle_report.uri)
|
44
|
+
end
|
45
|
+
|
46
|
+
should 'have the status attribute' do
|
47
|
+
assert_equal(test_motor_vehicle_report[:status], @motor_vehicle_report.status)
|
48
|
+
end
|
49
|
+
|
50
|
+
should 'have the created_at attribute' do
|
51
|
+
assert_equal(test_motor_vehicle_report[:created_at], @motor_vehicle_report.created_at)
|
52
|
+
end
|
53
|
+
|
54
|
+
should 'have the completed_at attribute' do
|
55
|
+
assert_equal(test_motor_vehicle_report[:completed_at], @motor_vehicle_report.completed_at)
|
56
|
+
end
|
57
|
+
|
58
|
+
should 'have the turnaround_time attribute' do
|
59
|
+
assert_equal(test_motor_vehicle_report[:turnaround_time], @motor_vehicle_report.turnaround_time)
|
60
|
+
end
|
61
|
+
|
62
|
+
should 'have the full_name attribute' do
|
63
|
+
assert_equal(test_motor_vehicle_report[:full_name], @motor_vehicle_report.full_name)
|
64
|
+
end
|
65
|
+
|
66
|
+
should 'have the license_number attribute' do
|
67
|
+
assert_equal(test_motor_vehicle_report[:license_number], @motor_vehicle_report.license_number)
|
68
|
+
end
|
69
|
+
|
70
|
+
should 'have the license_state attribute' do
|
71
|
+
assert_equal(test_motor_vehicle_report[:license_state], @motor_vehicle_report.license_state)
|
72
|
+
end
|
73
|
+
|
74
|
+
should 'have the previous_license_number attribute' do
|
75
|
+
assert_equal(test_motor_vehicle_report[:previous_license_number], @motor_vehicle_report.previous_license_number)
|
76
|
+
end
|
77
|
+
|
78
|
+
should 'have the previous_license_state attribute' do
|
79
|
+
assert_equal(test_motor_vehicle_report[:previous_license_state], @motor_vehicle_report.previous_license_state)
|
80
|
+
end
|
81
|
+
|
82
|
+
should 'have the license_status attribute' do
|
83
|
+
assert_equal(test_motor_vehicle_report[:license_status], @motor_vehicle_report.license_status)
|
84
|
+
end
|
85
|
+
|
86
|
+
should 'have the license_type attribute' do
|
87
|
+
assert_equal(test_motor_vehicle_report[:license_type], @motor_vehicle_report.license_type)
|
88
|
+
end
|
89
|
+
|
90
|
+
should 'have the license_class attribute' do
|
91
|
+
assert_equal(test_motor_vehicle_report[:license_class], @motor_vehicle_report.license_class)
|
92
|
+
end
|
93
|
+
|
94
|
+
should 'have the expiration_date attribute' do
|
95
|
+
assert_equal(test_motor_vehicle_report[:expiration_date], @motor_vehicle_report.expiration_date)
|
96
|
+
end
|
97
|
+
|
98
|
+
should 'have the issued_date attribute' do
|
99
|
+
assert_equal(test_motor_vehicle_report[:issued_date], @motor_vehicle_report.issued_date)
|
100
|
+
end
|
101
|
+
|
102
|
+
should 'have the first_issued_date attribute' do
|
103
|
+
assert_equal(test_motor_vehicle_report[:first_issued_date], @motor_vehicle_report.first_issued_date)
|
104
|
+
end
|
105
|
+
|
106
|
+
should 'have the inferred_issued_date attribute' do
|
107
|
+
assert_equal(test_motor_vehicle_report[:inferred_issued_date], @motor_vehicle_report.inferred_issued_date)
|
108
|
+
end
|
109
|
+
|
110
|
+
should 'have the restrictions attribute' do
|
111
|
+
assert_equal(test_motor_vehicle_report[:restrictions], @motor_vehicle_report.restrictions)
|
112
|
+
end
|
113
|
+
|
114
|
+
should 'have the accidents attribute' do
|
115
|
+
assert_equal(test_motor_vehicle_report[:accidents], @motor_vehicle_report.accidents)
|
116
|
+
end
|
117
|
+
|
118
|
+
should 'have the violations attribute' do
|
119
|
+
assert_equal(test_motor_vehicle_report[:violations], @motor_vehicle_report.violations)
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
should 'be registered' do
|
125
|
+
assert(APIClass.subclasses.include?(MotorVehicleReport))
|
126
|
+
assert_equal(MotorVehicleReport, APIClass.subclass_fetch("motor_vehicle_report"))
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Checkr
|
4
|
+
class NationalCriminalSearchTest < Test::Unit::TestCase
|
5
|
+
setup do
|
6
|
+
@national_criminal_search_url = "#{Checkr.api_base}/v1/national_criminal_searches"
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'NationalCriminalSearch class' do
|
10
|
+
should 'be retrieveable' do
|
11
|
+
id = "national_criminal_search_id"
|
12
|
+
@mock.expects(:get).once.with("#{@national_criminal_search_url}/#{id}", anything, anything).returns(test_response(test_national_criminal_search))
|
13
|
+
national_criminal_search = NationalCriminalSearch.retrieve(id)
|
14
|
+
assert(national_criminal_search.is_a?(NationalCriminalSearch))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'NationalCriminalSearch instance' do
|
19
|
+
should 'be refreshable' do
|
20
|
+
@mock.expects(:get).once.with("#{@national_criminal_search_url}/#{test_national_criminal_search[:id]}", anything, anything).returns(test_response(test_national_criminal_search))
|
21
|
+
national_criminal_search = NationalCriminalSearch.new(test_national_criminal_search[:id])
|
22
|
+
national_criminal_search.refresh
|
23
|
+
assert_equal(test_national_criminal_search[:status], national_criminal_search.status)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
context 'Retrieved NationalCriminalSearch instance' do
|
29
|
+
setup do
|
30
|
+
@mock.expects(:get).once.returns(test_response(test_national_criminal_search))
|
31
|
+
@national_criminal_search = NationalCriminalSearch.retrieve('national_criminal_search_id')
|
32
|
+
end
|
33
|
+
|
34
|
+
should 'have the id attribute' do
|
35
|
+
assert_equal(test_national_criminal_search[:id], @national_criminal_search.id)
|
36
|
+
end
|
37
|
+
|
38
|
+
should 'have the object attribute' do
|
39
|
+
assert_equal(test_national_criminal_search[:object], @national_criminal_search.object)
|
40
|
+
end
|
41
|
+
|
42
|
+
should 'have the uri attribute' do
|
43
|
+
assert_equal(test_national_criminal_search[:uri], @national_criminal_search.uri)
|
44
|
+
end
|
45
|
+
|
46
|
+
should 'have the status attribute' do
|
47
|
+
assert_equal(test_national_criminal_search[:status], @national_criminal_search.status)
|
48
|
+
end
|
49
|
+
|
50
|
+
should 'have the created_at attribute' do
|
51
|
+
assert_equal(test_national_criminal_search[:created_at], @national_criminal_search.created_at)
|
52
|
+
end
|
53
|
+
|
54
|
+
should 'have the completed_at attribute' do
|
55
|
+
assert_equal(test_national_criminal_search[:completed_at], @national_criminal_search.completed_at)
|
56
|
+
end
|
57
|
+
|
58
|
+
should 'have the turnaround_time attribute' do
|
59
|
+
assert_equal(test_national_criminal_search[:turnaround_time], @national_criminal_search.turnaround_time)
|
60
|
+
end
|
61
|
+
|
62
|
+
should 'have the records attribute' do
|
63
|
+
assert_equal(test_national_criminal_search[:records], @national_criminal_search.records)
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
should 'be registered' do
|
69
|
+
assert(APIClass.subclasses.include?(NationalCriminalSearch))
|
70
|
+
assert_equal(NationalCriminalSearch, APIClass.subclass_fetch("national_criminal_search"))
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Checkr
|
4
|
+
class ReportTest < Test::Unit::TestCase
|
5
|
+
setup do
|
6
|
+
@report_url = "#{Checkr.api_base}/v1/reports"
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'Report class' do
|
10
|
+
should 'be retrieveable' do
|
11
|
+
id = "report_id"
|
12
|
+
@mock.expects(:get).once.with("#{@report_url}/#{id}", anything, anything).returns(test_response(test_report))
|
13
|
+
report = Report.retrieve(id)
|
14
|
+
assert(report.is_a?(Report))
|
15
|
+
end
|
16
|
+
|
17
|
+
should 'be createable' do
|
18
|
+
@mock.expects(:post).once.with(@report_url, anything, test_report).returns(test_response(test_report))
|
19
|
+
report = Report.create(test_report)
|
20
|
+
assert(report.is_a?(Report))
|
21
|
+
assert_equal(test_report[:id], report.id)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'Report instance' do
|
26
|
+
should 'be refreshable' do
|
27
|
+
@mock.expects(:get).once.with("#{@report_url}/#{test_report[:id]}", anything, anything).returns(test_response(test_report))
|
28
|
+
report = Report.new(test_report[:id])
|
29
|
+
report.refresh
|
30
|
+
assert_equal(test_report[:package], report.package)
|
31
|
+
end
|
32
|
+
|
33
|
+
should 'be updateable' do
|
34
|
+
report = Report.new(test_report)
|
35
|
+
report.package = "driver_plus"
|
36
|
+
|
37
|
+
@mock.expects(:post).once.with do |url, headers, params|
|
38
|
+
params == report.changed_attributes && url == "#{@report_url}/#{report.id}"
|
39
|
+
end.returns(test_response(test_report))
|
40
|
+
|
41
|
+
# This should update this instance with test_report since it was returned
|
42
|
+
report.save
|
43
|
+
assert_equal(test_report[:package], report.package)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
context 'Retrieved Report instance' do
|
49
|
+
setup do
|
50
|
+
@mock.expects(:get).once.returns(test_response(test_report))
|
51
|
+
@report = Report.retrieve('report_id')
|
52
|
+
end
|
53
|
+
|
54
|
+
should 'have the id attribute' do
|
55
|
+
assert_equal(test_report[:id], @report.id)
|
56
|
+
end
|
57
|
+
|
58
|
+
should 'have the object attribute' do
|
59
|
+
assert_equal(test_report[:object], @report.object)
|
60
|
+
end
|
61
|
+
|
62
|
+
should 'have the uri attribute' do
|
63
|
+
assert_equal(test_report[:uri], @report.uri)
|
64
|
+
end
|
65
|
+
|
66
|
+
should 'have the status attribute' do
|
67
|
+
assert_equal(test_report[:status], @report.status)
|
68
|
+
end
|
69
|
+
|
70
|
+
should 'have the created_at attribute' do
|
71
|
+
assert_equal(test_report[:created_at], @report.created_at)
|
72
|
+
end
|
73
|
+
|
74
|
+
should 'have the completed_at attribute' do
|
75
|
+
assert_equal(test_report[:completed_at], @report.completed_at)
|
76
|
+
end
|
77
|
+
|
78
|
+
should 'have the turnaround_time attribute' do
|
79
|
+
assert_equal(test_report[:turnaround_time], @report.turnaround_time)
|
80
|
+
end
|
81
|
+
|
82
|
+
should 'have the package attribute' do
|
83
|
+
assert_equal(test_report[:package], @report.package)
|
84
|
+
end
|
85
|
+
|
86
|
+
should 'have the candidate_id attribute' do
|
87
|
+
assert_equal(test_report[:candidate_id], @report.candidate.id)
|
88
|
+
assert(@report.candidate.is_a?(Candidate))
|
89
|
+
end
|
90
|
+
|
91
|
+
should 'have the ssn_trace_id attribute' do
|
92
|
+
assert_equal(test_report[:ssn_trace_id], @report.ssn_trace.id)
|
93
|
+
assert(@report.ssn_trace.is_a?(SSNTrace))
|
94
|
+
end
|
95
|
+
|
96
|
+
should 'have the sex_offender_search_id attribute' do
|
97
|
+
assert_equal(test_report[:sex_offender_search_id], @report.sex_offender_search.id)
|
98
|
+
assert(@report.sex_offender_search.is_a?(SexOffenderSearch))
|
99
|
+
end
|
100
|
+
|
101
|
+
should 'have the national_criminal_search_id attribute' do
|
102
|
+
assert_equal(test_report[:national_criminal_search_id], @report.national_criminal_search.id)
|
103
|
+
assert(@report.national_criminal_search.is_a?(NationalCriminalSearch))
|
104
|
+
end
|
105
|
+
|
106
|
+
should 'have the county_criminal_search_ids attribute' do
|
107
|
+
assert_equal(test_report[:county_criminal_search_ids], @report.county_criminal_searches.json)
|
108
|
+
assert(@report.county_criminal_searches.is_a?(APIList))
|
109
|
+
end
|
110
|
+
|
111
|
+
should 'have the motor_vehicle_report_id attribute' do
|
112
|
+
assert_equal(test_report[:motor_vehicle_report_id], @report.motor_vehicle_report.id)
|
113
|
+
assert(@report.motor_vehicle_report.is_a?(MotorVehicleReport))
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
should 'be registered' do
|
119
|
+
assert(APIClass.subclasses.include?(Report))
|
120
|
+
assert_equal(Report, APIClass.subclass_fetch("report"))
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Checkr
|
4
|
+
class SexOffenderSearchTest < Test::Unit::TestCase
|
5
|
+
setup do
|
6
|
+
@sex_offender_search_url = "#{Checkr.api_base}/v1/sex_offender_searches"
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'SexOffenderSearch class' do
|
10
|
+
should 'be retrieveable' do
|
11
|
+
id = "sex_offender_search_id"
|
12
|
+
@mock.expects(:get).once.with("#{@sex_offender_search_url}/#{id}", anything, anything).returns(test_response(test_sex_offender_search))
|
13
|
+
sex_offender_search = SexOffenderSearch.retrieve(id)
|
14
|
+
assert(sex_offender_search.is_a?(SexOffenderSearch))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'SexOffenderSearch instance' do
|
19
|
+
should 'be refreshable' do
|
20
|
+
@mock.expects(:get).once.with("#{@sex_offender_search_url}/#{test_sex_offender_search[:id]}", anything, anything).returns(test_response(test_sex_offender_search))
|
21
|
+
sex_offender_search = SexOffenderSearch.new(test_sex_offender_search[:id])
|
22
|
+
sex_offender_search.refresh
|
23
|
+
assert_equal(test_sex_offender_search[:status], sex_offender_search.status)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
context 'Retrieved SexOffenderSearch instance' do
|
29
|
+
setup do
|
30
|
+
@mock.expects(:get).once.returns(test_response(test_sex_offender_search))
|
31
|
+
@sex_offender_search = SexOffenderSearch.retrieve('sex_offender_search_id')
|
32
|
+
end
|
33
|
+
|
34
|
+
should 'have the id attribute' do
|
35
|
+
assert_equal(test_sex_offender_search[:id], @sex_offender_search.id)
|
36
|
+
end
|
37
|
+
|
38
|
+
should 'have the object attribute' do
|
39
|
+
assert_equal(test_sex_offender_search[:object], @sex_offender_search.object)
|
40
|
+
end
|
41
|
+
|
42
|
+
should 'have the uri attribute' do
|
43
|
+
assert_equal(test_sex_offender_search[:uri], @sex_offender_search.uri)
|
44
|
+
end
|
45
|
+
|
46
|
+
should 'have the status attribute' do
|
47
|
+
assert_equal(test_sex_offender_search[:status], @sex_offender_search.status)
|
48
|
+
end
|
49
|
+
|
50
|
+
should 'have the created_at attribute' do
|
51
|
+
assert_equal(test_sex_offender_search[:created_at], @sex_offender_search.created_at)
|
52
|
+
end
|
53
|
+
|
54
|
+
should 'have the completed_at attribute' do
|
55
|
+
assert_equal(test_sex_offender_search[:completed_at], @sex_offender_search.completed_at)
|
56
|
+
end
|
57
|
+
|
58
|
+
should 'have the turnaround_time attribute' do
|
59
|
+
assert_equal(test_sex_offender_search[:turnaround_time], @sex_offender_search.turnaround_time)
|
60
|
+
end
|
61
|
+
|
62
|
+
should 'have the records attribute' do
|
63
|
+
assert_equal(test_sex_offender_search[:records], @sex_offender_search.records)
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
should 'be registered' do
|
70
|
+
assert(APIClass.subclasses.include?(SexOffenderSearch))
|
71
|
+
assert_equal(SexOffenderSearch, APIClass.subclass_fetch("sex_offender_search"))
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|