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/cluster_list_spec.rb
CHANGED
@@ -3,10 +3,83 @@ require 'spec_helper'
|
|
3
3
|
describe Verso::ClusterList do
|
4
4
|
use_vcr_cassette :record => :new_episodes
|
5
5
|
|
6
|
-
|
7
|
-
list = Verso::ClusterList.new
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
before(:each) do
|
7
|
+
@list = Verso::ClusterList.new
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#[]' do
|
11
|
+
it 'responds' do
|
12
|
+
@list.should respond_to(:[])
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'is a Verso::Cluster object' do
|
16
|
+
@list[3].should be_a(Verso::Cluster)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#each' do
|
21
|
+
it 'responds' do
|
22
|
+
@list.should respond_to(:each)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'yields' do
|
26
|
+
expect { |b| @list.each("foo", &b).to yield_control }
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'yields Verso::Cluster objects' do
|
30
|
+
@list.each do |c|
|
31
|
+
c.should be_a(Verso::Cluster)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#empty?' do
|
37
|
+
it 'responds' do
|
38
|
+
@list.should respond_to(:empty?)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'is not empty' do
|
42
|
+
@list.should_not be_empty
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#last' do
|
47
|
+
it 'responds' do
|
48
|
+
@list.should respond_to(:last)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'is a Verso::Cluster object' do
|
52
|
+
@list.last.should be_a(Verso::Cluster)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#length' do
|
57
|
+
it 'responds' do
|
58
|
+
@list.should respond_to(:length)
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'is 16' do
|
62
|
+
@list.length.should == 16
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#first' do
|
67
|
+
it 'responds' do
|
68
|
+
@list.should respond_to(:first)
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'is a Verso::Cluster object' do
|
72
|
+
@list.first.should be_a(Verso::Cluster)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe '#count' do
|
77
|
+
it 'responds' do
|
78
|
+
@list.should respond_to(:count)
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'is 16' do
|
82
|
+
@list.count.should == 16
|
83
|
+
end
|
11
84
|
end
|
12
85
|
end
|
data/spec/cluster_spec.rb
CHANGED
@@ -1,18 +1,115 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Verso::Cluster do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
use_vcr_cassette :record => :new_episodes
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@cluster = Verso::ClusterList.new.first
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#code' do
|
11
|
+
it 'responds' do
|
12
|
+
@cluster.should respond_to(:code)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'is String' do
|
16
|
+
@cluster.code.should be_a(String)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'is formatted like CT1, CT2, etc.' do
|
20
|
+
@cluster.code.should match(/CT\d+/)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#contact' do
|
25
|
+
it 'responds' do
|
26
|
+
@cluster.should respond_to(:contact)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'is an OpenStruct' do
|
30
|
+
@cluster.contact.should be_a(OpenStruct)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'has name' do
|
34
|
+
@cluster.contact.name.should be_a(String)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'has email' do
|
38
|
+
@cluster.contact.email.should match(/\w+@doe.virginia.gov/)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'has phone' do
|
42
|
+
@cluster.contact.phone.should match(/\d{3}-\d{3}-\d{4}/)
|
43
|
+
end
|
9
44
|
end
|
10
45
|
|
11
|
-
|
12
|
-
|
46
|
+
describe '#description' do
|
47
|
+
it 'responds' do
|
48
|
+
@cluster.should respond_to(:description)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'is String' do
|
52
|
+
@cluster.description.should be_a(String)
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'is HTML' do
|
56
|
+
@cluster.description.should match(/<\/.+>/)
|
57
|
+
end
|
13
58
|
end
|
14
59
|
|
15
|
-
|
16
|
-
|
60
|
+
describe '#id' do
|
61
|
+
it 'responds' do
|
62
|
+
@cluster.should respond_to(:id)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'is Fixnum' do
|
66
|
+
@cluster.id.should be_a(Fixnum)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'is not the same as #object_id' do
|
70
|
+
@cluster.id.should_not == @cluster.object_id
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe '#pathways' do
|
75
|
+
it 'responds' do
|
76
|
+
@cluster.should respond_to(:pathways)
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'is Array' do
|
80
|
+
@cluster.pathways.should be_a(Array)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'includes a Pathway' do
|
84
|
+
@cluster.pathways.first.should be_a(Verso::Pathway)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe '#postsecondary_info' do
|
89
|
+
it 'responds' do
|
90
|
+
@cluster.should respond_to(:postsecondary_info)
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'is String' do
|
94
|
+
@cluster.postsecondary_info.should be_a(String)
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'is HTML' do
|
98
|
+
@cluster.postsecondary_info.should match(/<\/.+>/)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe '#title' do
|
103
|
+
it 'responds' do
|
104
|
+
@cluster.should respond_to(:title)
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'returns String' do
|
108
|
+
@cluster.title.should be_a(String)
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'returns correct title' do
|
112
|
+
@cluster.title.should == 'Agriculture, Food and Natural Resources'
|
113
|
+
end
|
17
114
|
end
|
18
115
|
end
|
@@ -1,55 +1,113 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Verso::CorrelationList do
|
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
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
4
|
+
use_vcr_cassette :record => :new_episodes
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@list = Verso::CorrelationList.new(
|
8
|
+
:code => "6320",
|
9
|
+
:edition => Verso::EditionList.new.last.year,
|
10
|
+
:name => "english"
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#code' do
|
15
|
+
it { @list.code.should == '6320' }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#edition' do
|
19
|
+
it { @list.edition.should match(/2\d{3}/) }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#name' do
|
23
|
+
it { @list.name.should == 'english' }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#title' do
|
27
|
+
it { @list.title.should == 'English' }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#[]' do
|
31
|
+
it 'responds' do
|
32
|
+
@list.should respond_to(:[])
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'is a Verso::Task' do
|
36
|
+
@list[@list.count / 2].should be_a(Verso::Task)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#each' do
|
41
|
+
it 'responds' do
|
42
|
+
@list.should respond_to(:each)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'yields' do
|
46
|
+
expect { |b| @list.each("foo", &b).to yield_control }
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'yields a Verso::Task' do
|
50
|
+
@list.each do |t|
|
51
|
+
t.should be_a(Verso::Task)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#empty?' do
|
57
|
+
it 'responds' do
|
58
|
+
@list.should respond_to(:empty?)
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'is not empty' do
|
62
|
+
@list.should_not be_empty
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#last' do
|
67
|
+
it 'responds' do
|
68
|
+
@list.should respond_to(:last)
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'is a Verso::Task' do
|
72
|
+
@list.last.should be_a(Verso::Task)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe '#length' do
|
77
|
+
it 'responds' do
|
78
|
+
@list.should respond_to(:length)
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'is a Fixnum' do
|
82
|
+
@list.length.should be_a(Fixnum)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'is not zero' do
|
86
|
+
@list.length.should_not == 0
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe '#first' do
|
91
|
+
it 'responds' do
|
92
|
+
@list.should respond_to(:first)
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'is a Verso::Task' do
|
96
|
+
@list.first.should be_a(Verso::Task)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe '#count' do
|
101
|
+
it 'responds' do
|
102
|
+
@list.should respond_to(:count)
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'is a Fixnum' do
|
106
|
+
@list.count.should be_a(Fixnum)
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'is not zero' do
|
110
|
+
@list.count.should_not == 0
|
111
|
+
end
|
54
112
|
end
|
55
113
|
end
|
data/spec/course_list_spec.rb
CHANGED
@@ -3,34 +3,123 @@ require 'spec_helper'
|
|
3
3
|
describe Verso::CourseList do
|
4
4
|
use_vcr_cassette :record => :new_episodes
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
describe 'searches' do
|
7
|
+
it "searches by code" do
|
8
|
+
results = Verso::CourseList.new(:code => "6320")
|
9
|
+
results.each { |c| c.code.should == "6320" }
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
it "searches by edition" do
|
13
|
+
year = Verso::EditionList.new.first.year
|
14
|
+
results = Verso::CourseList.new(:edition => year)
|
15
|
+
results.first.edition.should == year
|
16
|
+
results.last.edition.should == year
|
17
|
+
end
|
15
18
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
it "searches by text" do
|
20
|
+
results = Verso::CourseList.new(:text => "6321")
|
21
|
+
results.first.title.strip.should eq("Accounting, Advanced")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "searches by cluster" do
|
25
|
+
results = Verso::CourseList.new(:cluster => "education and training")
|
26
|
+
results.first.title.strip.
|
27
|
+
should eq("Equine Management Production")
|
28
|
+
end
|
21
29
|
|
22
|
-
|
23
|
-
|
24
|
-
|
30
|
+
it "can find courses by program area too" do
|
31
|
+
results = Verso::CourseList.new(:program_area => "across the board")
|
32
|
+
results.first.title.strip.should eq("Work-Based Learning through Service")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should return empty results when queries are empty" do
|
36
|
+
Verso::CourseList.new({}).count.should == 0
|
37
|
+
[:text, :program_area, :cluster].each do |k|
|
38
|
+
Verso::CourseList.new(k => nil).count.should == 0
|
39
|
+
Verso::CourseList.new(k => '').count.should == 0
|
40
|
+
end
|
41
|
+
Verso::CourseList.new(:text => '', :program_area => '', :cluster => '').
|
42
|
+
count.should == 0
|
43
|
+
end
|
25
44
|
end
|
26
45
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
46
|
+
describe 'array-like behavior' do
|
47
|
+
before(:each) do
|
48
|
+
@courses = Verso::CourseList.new(:cluster => "Information Technology")
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#[]' do
|
52
|
+
it 'responds' do
|
53
|
+
@courses.should respond_to(:[])
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'gets a Verso::Course object' do
|
57
|
+
@courses[10].should be_a(Verso::Course)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#each' do
|
62
|
+
it 'responds' do
|
63
|
+
@courses.should respond_to(:each)
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'yields' do
|
67
|
+
expect { |b| @courses.each("foo", &b).to yield_control }
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'yields Verso::Course objects' do
|
71
|
+
@courses.each { |c| c.should be_a(Verso::Course) }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#empty?' do
|
76
|
+
it 'responds' do
|
77
|
+
@courses.should respond_to(:empty?)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'is not empty' do
|
81
|
+
@courses.should_not be_empty
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe '#last' do
|
86
|
+
it 'responds' do
|
87
|
+
@courses.should respond_to(:last)
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'is a Verso::Course object' do
|
91
|
+
@courses.last.should be_a(Verso::Course)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe '#length' do
|
96
|
+
it 'responds' do
|
97
|
+
@courses.should respond_to(:length)
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'is a Fixnum' do
|
101
|
+
@courses.length.should be_a(Fixnum)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe '#first' do
|
106
|
+
it 'responds' do
|
107
|
+
@courses.should respond_to(:first)
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'is a Verso::Course object' do
|
111
|
+
@courses.first.should be_a(Verso::Course)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe '#count' do
|
116
|
+
it 'responds' do
|
117
|
+
@courses.should respond_to(:count)
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'is a Fixnum' do
|
121
|
+
@courses.count.should be_a(Fixnum)
|
122
|
+
end
|
32
123
|
end
|
33
|
-
Verso::CourseList.new(:text => '', :program_area => '', :cluster => '').
|
34
|
-
count.should == 0
|
35
124
|
end
|
36
125
|
end
|