verso 0.0.2 → 0.0.3
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.
- data/.gitignore +2 -0
- data/README.md +10 -22
- data/lib/verso.rb +10 -2
- data/lib/verso/base.rb +50 -0
- data/lib/verso/cluster.rb +55 -25
- data/lib/verso/cluster_list.rb +15 -10
- data/lib/verso/correlation_list.rb +30 -40
- data/lib/verso/course.rb +106 -43
- data/lib/verso/course_list.rb +57 -21
- data/lib/verso/credential.rb +94 -20
- data/lib/verso/credential_list.rb +30 -15
- data/lib/verso/duty_area.rb +23 -10
- data/lib/verso/edition_list.rb +18 -10
- data/lib/verso/emphasis.rb +26 -12
- data/lib/verso/emphasis_list.rb +18 -10
- data/lib/verso/examination_list.rb +28 -12
- data/lib/verso/extra.rb +34 -32
- data/lib/verso/extras_list.rb +28 -12
- data/lib/verso/frontmatter.rb +43 -11
- data/lib/verso/hash.rb +19 -0
- data/lib/verso/http_gettable.rb +31 -0
- data/lib/verso/occupation.rb +36 -14
- data/lib/verso/occupation_data.rb +35 -14
- data/lib/verso/occupation_list.rb +23 -20
- data/lib/verso/pathway.rb +32 -14
- data/lib/verso/program_area.rb +42 -21
- data/lib/verso/program_area_list.rb +15 -11
- data/lib/verso/standard.rb +45 -23
- data/lib/verso/standards_list.rb +41 -30
- data/lib/verso/task.rb +52 -17
- data/lib/verso/task_list.rb +40 -17
- data/lib/verso/version.rb +1 -1
- data/spec/cluster_list_spec.rb +78 -5
- data/spec/cluster_spec.rb +106 -9
- data/spec/correlation_list_spec.rb +108 -50
- data/spec/course_list_spec.rb +112 -23
- data/spec/course_spec.rb +321 -127
- data/spec/credential_list_spec.rb +83 -52
- data/spec/credential_spec.rb +358 -19
- data/spec/duty_area_spec.rb +47 -17
- data/spec/edition_list_spec.rb +90 -4
- data/spec/emphasis_list_spec.rb +75 -11
- data/spec/emphasis_spec.rb +37 -21
- data/spec/examination_list_spec.rb +146 -20
- data/spec/extra_spec.rb +61 -22
- data/spec/extras_list_spec.rb +80 -17
- data/spec/frontmatter_spec.rb +141 -6
- data/spec/hash_spec.rb +49 -0
- data/spec/occupation_data_spec.rb +31 -13
- data/spec/occupation_list_spec.rb +88 -15
- data/spec/occupation_spec.rb +72 -28
- data/spec/pathway_spec.rb +47 -27
- data/spec/program_area_list_spec.rb +78 -4
- data/spec/program_area_spec.rb +70 -22
- data/spec/standard_spec.rb +94 -36
- data/spec/standards_list_spec.rb +130 -36
- data/spec/task_list_spec.rb +160 -51
- data/spec/task_spec.rb +120 -33
- data/verso.gemspec +3 -1
- metadata +41 -17
- data/lib/verso/http_get.rb +0 -9
- data/lib/verso/sol_correlation_list.rb +0 -53
- data/spec/sol_correlation_list_spec.rb +0 -74
data/spec/course_spec.rb
CHANGED
@@ -1,193 +1,387 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Verso::Course do
|
4
|
+
use_vcr_cassette :record => :new_episodes
|
5
|
+
|
4
6
|
before do
|
5
|
-
|
6
|
-
|
7
|
-
},
|
8
|
-
{"title" => "License 1", "type" => "License" }]
|
9
|
-
prerequisite_courses = [{
|
10
|
-
"code" => "2222", "hours" => nil, "duration" => 36,
|
11
|
-
"title" => "Basketweaving", "co_op" => true
|
12
|
-
}]
|
13
|
-
occupation_data = [{
|
14
|
-
"cluster" => { "title" => "Information Technology" },
|
15
|
-
"pathway" => { "title" => "Information and Support Services" },
|
16
|
-
"occupations" => [{ "title" => "Database Analyst" }]
|
17
|
-
}]
|
18
|
-
@extra = double("ExtrasList", :title => "Extra Title",
|
19
|
-
:name => "extra_name")
|
20
|
-
@course = Verso::Course.new("code" => "6321", "duration" => 36,
|
21
|
-
"title" => "Accounting, Advanced",
|
22
|
-
"hours" => nil, "edition" => "2011",
|
23
|
-
"co_op" => true,
|
24
|
-
"related_resources" => ["extras"],
|
25
|
-
"grade_levels" => "8 9 10",
|
26
|
-
"credentials" => credentials,
|
27
|
-
"occupation_data" => occupation_data,
|
28
|
-
"related_courses" => prerequisite_courses,
|
29
|
-
"prerequisite_courses" => prerequisite_courses)
|
7
|
+
@course = Verso::Course.new(:code => "6321",
|
8
|
+
:edition => Verso::EditionList.new.last.year)
|
30
9
|
end
|
31
10
|
|
32
|
-
|
33
|
-
|
34
|
-
|
11
|
+
describe '#certifications' do
|
12
|
+
it 'responds' do
|
13
|
+
@course.should respond_to(:certifications)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'is an Array' do
|
17
|
+
@course.certifications.should be_a(Array)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'is an Array of Verso::Credential objects' do
|
21
|
+
@course.certifications.first.should be_a(Verso::Credential)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "is an Array of Verso::Credential objects with type 'Certification'" do
|
25
|
+
@course.certifications.first.type.should == 'Certification'
|
26
|
+
end
|
35
27
|
end
|
36
28
|
|
37
|
-
|
38
|
-
|
29
|
+
describe '#co_op' do
|
30
|
+
it 'responds' do
|
31
|
+
@course.should respond_to(:co_op)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'is Boolean' do
|
35
|
+
@course.co_op.should be_true
|
36
|
+
end
|
39
37
|
end
|
40
38
|
|
41
|
-
|
42
|
-
|
39
|
+
describe '#co_op?' do
|
40
|
+
it 'responds' do
|
41
|
+
@course.should respond_to(:co_op?)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'is Boolean' do
|
45
|
+
@course.should be_co_op
|
46
|
+
end
|
43
47
|
end
|
44
48
|
|
45
|
-
|
46
|
-
|
49
|
+
describe '#complement' do
|
50
|
+
it 'responds' do
|
51
|
+
@course.should respond_to(:complement)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'is Boolean' do
|
55
|
+
@course.complement.should be_false
|
56
|
+
end
|
47
57
|
end
|
48
58
|
|
49
|
-
|
50
|
-
|
59
|
+
describe '#complement?' do
|
60
|
+
it 'responds' do
|
61
|
+
@course.should respond_to(:complement?)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'is Boolean' do
|
65
|
+
@course.should_not be_complement
|
66
|
+
end
|
51
67
|
end
|
52
68
|
|
53
|
-
|
54
|
-
|
69
|
+
describe '#code' do
|
70
|
+
it 'responds' do
|
71
|
+
@course.should respond_to(:code)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'is a String' do
|
75
|
+
@course.code.should be_a(String)
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'looks like a course code' do
|
79
|
+
@course.code.should match(/\d{4}/)
|
80
|
+
end
|
55
81
|
end
|
56
82
|
|
57
|
-
|
58
|
-
|
83
|
+
describe '#credentials' do
|
84
|
+
it 'responds' do
|
85
|
+
@course.should respond_to(:credentials)
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'is an Array' do
|
89
|
+
@course.credentials.should be_a(Array)
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'is an Array of Verso::Credential objects' do
|
93
|
+
@course.credentials.first.should be_a(Verso::Credential)
|
94
|
+
end
|
59
95
|
end
|
60
96
|
|
61
|
-
|
62
|
-
|
97
|
+
describe '#description' do
|
98
|
+
it 'responds' do
|
99
|
+
@course.should respond_to(:description)
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'is a String' do
|
103
|
+
@course.description.should be_a(String)
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'looks like HTML' do
|
107
|
+
@course.description.should match(/<\/.+>/)
|
108
|
+
end
|
63
109
|
end
|
64
110
|
|
65
|
-
|
66
|
-
|
67
|
-
|
111
|
+
describe '#duration' do
|
112
|
+
it 'responds' do
|
113
|
+
@course.should respond_to(:duration)
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'is a Fixnum' do
|
117
|
+
@course.duration.should be_a(Fixnum)
|
118
|
+
end
|
68
119
|
end
|
69
120
|
|
70
|
-
|
71
|
-
|
72
|
-
|
121
|
+
describe '#duty_areas' do
|
122
|
+
it 'responds' do
|
123
|
+
@course.should respond_to(:duty_areas)
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'is a Verso::TaskList' do
|
127
|
+
@course.duty_areas.should be_a(Verso::TaskList)
|
128
|
+
end
|
73
129
|
end
|
74
130
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
Verso::
|
81
|
-
|
82
|
-
|
83
|
-
@course.duty_areas.first.should eq(@duty_area)
|
131
|
+
describe '#extras' do
|
132
|
+
it 'responds' do
|
133
|
+
@course.should respond_to(:extras)
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'is a Verso::ExtrasList' do
|
137
|
+
@course.extras.should be_a(Verso::ExtrasList)
|
138
|
+
end
|
84
139
|
end
|
85
140
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
Verso::OccupationData.should_receive(:new).and_return(@occlist)
|
95
|
-
@course.occupation_data.first.should eq(@occlist)
|
141
|
+
describe '#frontmatter' do
|
142
|
+
it 'responds' do
|
143
|
+
@course.should respond_to(:frontmatter)
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'is a Verso::Frontmatter object' do
|
147
|
+
@course.frontmatter.should be_a(Verso::Frontmatter)
|
148
|
+
end
|
96
149
|
end
|
97
150
|
|
98
|
-
|
99
|
-
|
151
|
+
describe '#grade_levels' do
|
152
|
+
it 'responds' do
|
153
|
+
@course.should respond_to(:grade_levels)
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'is a String' do
|
157
|
+
@course.grade_levels.should be_a(String)
|
158
|
+
end
|
159
|
+
|
160
|
+
it 'looks like grade levels' do
|
161
|
+
@course.grade_levels.should match(/\d{1,2} \d/)
|
162
|
+
end
|
100
163
|
end
|
101
164
|
|
102
|
-
|
103
|
-
|
104
|
-
|
165
|
+
describe '#hours' do
|
166
|
+
it 'responds' do
|
167
|
+
@course.should respond_to(:hours)
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'is Fixnum or nil' do
|
171
|
+
@course.hours.should == nil
|
172
|
+
dental = Verso::Course.new(:code => "8328",
|
173
|
+
:edition => Verso::EditionList.new.last.year)
|
174
|
+
dental.hours.should be_a(Fixnum)
|
175
|
+
end
|
105
176
|
end
|
106
177
|
|
107
|
-
|
108
|
-
|
109
|
-
|
178
|
+
describe '#hs_credit_in_ms' do
|
179
|
+
it 'responds' do
|
180
|
+
@course.should respond_to(:hs_credit_in_ms)
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'is Boolean' do
|
184
|
+
@course.hs_credit_in_ms.should be_false
|
185
|
+
end
|
110
186
|
end
|
111
187
|
|
112
|
-
|
113
|
-
|
114
|
-
|
188
|
+
describe '#hs_credit_in_ms?' do
|
189
|
+
it 'responds' do
|
190
|
+
@course.should respond_to(:hs_credit_in_ms?)
|
191
|
+
end
|
192
|
+
|
193
|
+
it 'is Boolean' do
|
194
|
+
@course.should_not be_hs_credit_in_ms
|
195
|
+
end
|
115
196
|
end
|
116
197
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
198
|
+
describe '#is_ms?' do
|
199
|
+
it 'responds' do
|
200
|
+
@course.should respond_to(:is_ms?)
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'is Boolean' do
|
204
|
+
@course.is_ms?.should be_false
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'is not middle school' do
|
208
|
+
@course.should_not be_is_ms
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe '#is_hs?' do
|
213
|
+
it 'responds' do
|
214
|
+
@course.should respond_to(:is_hs?)
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'is Boolean' do
|
218
|
+
@course.is_hs?.should be_true
|
219
|
+
end
|
220
|
+
|
221
|
+
it 'is high school' do
|
222
|
+
@course.should be_is_hs
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
describe '#licenses' do
|
227
|
+
before(:each) do
|
228
|
+
@barber = Verso::Course.new(:code => "8740",
|
229
|
+
:edition => Verso::EditionList.new.last.year)
|
230
|
+
end
|
231
|
+
|
232
|
+
it 'responds' do
|
233
|
+
@barber.should respond_to(:licenses)
|
234
|
+
end
|
235
|
+
|
236
|
+
it 'is an Array' do
|
237
|
+
@barber.licenses.should be_a(Array)
|
238
|
+
end
|
239
|
+
|
240
|
+
it 'is an Array of Verso::Credential objects' do
|
241
|
+
@barber.licenses.first.should be_a(Verso::Credential)
|
242
|
+
end
|
243
|
+
|
244
|
+
it "is an Array of Verso::Credential objects with type 'License'" do
|
245
|
+
@barber.licenses.first.type.should == 'License'
|
246
|
+
end
|
124
247
|
end
|
125
248
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
249
|
+
describe '#occupation_data' do
|
250
|
+
it 'responds' do
|
251
|
+
@course.should respond_to(:occupation_data)
|
252
|
+
end
|
253
|
+
|
254
|
+
it 'is an Array' do
|
255
|
+
@course.occupation_data.should be_a(Array)
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'is an Array of Verso::OccupationData objects' do
|
259
|
+
@course.occupation_data.first.should be_a(Verso::OccupationData)
|
260
|
+
end
|
136
261
|
end
|
137
262
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
263
|
+
describe '#osha_exempt' do
|
264
|
+
it 'responds' do
|
265
|
+
@course.should respond_to(:osha_exempt)
|
266
|
+
end
|
267
|
+
|
268
|
+
it 'is Boolean' do
|
269
|
+
@course.osha_exempt.should be_false
|
270
|
+
end
|
145
271
|
end
|
146
272
|
|
147
|
-
|
148
|
-
|
149
|
-
|
273
|
+
describe '#osha_exempt?' do
|
274
|
+
it 'responds' do
|
275
|
+
@course.should respond_to(:osha_exempt?)
|
276
|
+
end
|
277
|
+
|
278
|
+
it 'is Boolean' do
|
279
|
+
@course.osha_exempt?.should be_false
|
280
|
+
end
|
150
281
|
end
|
151
282
|
|
152
|
-
|
153
|
-
|
283
|
+
describe '#prerequisite_courses' do
|
284
|
+
it 'responds' do
|
285
|
+
@course.should respond_to(:prerequisite_courses)
|
286
|
+
end
|
154
287
|
|
155
|
-
|
156
|
-
@course
|
288
|
+
it 'is an Array' do
|
289
|
+
@course.prerequisite_courses.should be_a(Array)
|
157
290
|
end
|
158
291
|
|
159
|
-
it
|
160
|
-
@course.
|
292
|
+
it 'is an Array of Verso::Course objects' do
|
293
|
+
@course.prerequisite_courses.first.should be_a(Verso::Course)
|
161
294
|
end
|
162
295
|
end
|
163
296
|
|
164
|
-
|
165
|
-
|
166
|
-
@course
|
167
|
-
"grade_levels" => "8")
|
297
|
+
describe '#prerequisites' do
|
298
|
+
it 'responds' do
|
299
|
+
@course.should respond_to(:prerequisites)
|
168
300
|
end
|
169
301
|
|
170
|
-
it '
|
171
|
-
@course.
|
302
|
+
it 'is an Array' do
|
303
|
+
@course.prerequisites.should be_a(Array)
|
304
|
+
end
|
305
|
+
|
306
|
+
it 'is an Array of Verso::Course objects' do
|
307
|
+
@course.prerequisites.first.should be_a(Verso::Course)
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
describe '#related_courses' do
|
312
|
+
it 'responds' do
|
313
|
+
@course.should respond_to(:related_courses)
|
314
|
+
end
|
315
|
+
|
316
|
+
it 'is an Array' do
|
317
|
+
@course.related_courses.should be_a(Array)
|
318
|
+
end
|
319
|
+
|
320
|
+
it 'is an Array of Verso::Course objects' do
|
321
|
+
@course.related_courses.first.should be_a(Verso::Course)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
describe '#related_resources' do
|
326
|
+
it 'responds' do
|
327
|
+
@course.should respond_to(:related_resources)
|
328
|
+
end
|
329
|
+
|
330
|
+
it 'is an Array' do
|
331
|
+
@course.related_resources.should be_a(Array)
|
332
|
+
end
|
333
|
+
|
334
|
+
it 'is an Array of Strings' do
|
335
|
+
@course.related_resources.first.should be_a(String)
|
336
|
+
end
|
337
|
+
|
338
|
+
it "includes 'tasks'" do
|
339
|
+
@course.related_resources.should include('tasks')
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
describe '#standards' do
|
344
|
+
it 'responds' do
|
345
|
+
@course.should respond_to(:standards)
|
346
|
+
end
|
347
|
+
|
348
|
+
it 'is a Verso::StandardsList' do
|
349
|
+
@course.standards.should be_a(Verso::StandardsList)
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
describe '#task' do
|
354
|
+
it 'responds' do
|
355
|
+
@course.should respond_to(:task)
|
356
|
+
end
|
357
|
+
|
358
|
+
it 'returns a Verso::Task object' do
|
359
|
+
task_id = @course.duty_areas.last.tasks.first.id
|
360
|
+
@course.task(task_id).should be_a(Verso::Task)
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
describe '#tasklist' do
|
365
|
+
it 'responds' do
|
366
|
+
@course.should respond_to(:tasklist)
|
172
367
|
end
|
173
368
|
|
174
|
-
it '
|
175
|
-
@course.
|
369
|
+
it 'is a Verso::TaskList' do
|
370
|
+
@course.tasklist.should be_a(Verso::TaskList)
|
176
371
|
end
|
177
372
|
end
|
178
373
|
|
179
|
-
|
180
|
-
|
181
|
-
@course
|
182
|
-
"grade_levels" => "10")
|
374
|
+
describe '#title' do
|
375
|
+
it 'responds' do
|
376
|
+
@course.should respond_to(:title)
|
183
377
|
end
|
184
378
|
|
185
|
-
it '
|
186
|
-
@course.
|
379
|
+
it 'is a String' do
|
380
|
+
@course.title.should be_a(String)
|
187
381
|
end
|
188
382
|
|
189
|
-
it '
|
190
|
-
@course.
|
383
|
+
it 'is about Accounting' do
|
384
|
+
@course.title.should match(/Accounting/)
|
191
385
|
end
|
192
386
|
end
|
193
387
|
end
|