verso 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,21 +1,94 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Verso::OccupationList do
|
4
|
+
use_vcr_cassette :record => :new_episodes
|
5
|
+
|
6
|
+
describe 'array-like behavior' do
|
7
|
+
before(:each) do
|
8
|
+
@occupations = Verso::OccupationList.new(:text => "teacher")
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#[]' do
|
12
|
+
it 'responds' do
|
13
|
+
@occupations.should respond_to(:[])
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'gets a Verso::OccupationData object' do
|
17
|
+
@occupations[10].should be_a(Verso::OccupationData)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#each' do
|
22
|
+
it 'responds' do
|
23
|
+
@occupations.should respond_to(:each)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'yields' do
|
27
|
+
expect { |b| @occupations.each("foo", &b).to yield_control }
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'yields Verso::OccupationData objects' do
|
31
|
+
@occupations.each { |c| c.should be_a(Verso::OccupationData) }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#empty?' do
|
36
|
+
it 'responds' do
|
37
|
+
@occupations.should respond_to(:empty?)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'is not empty' do
|
41
|
+
@occupations.should_not be_empty
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#last' do
|
46
|
+
it 'responds' do
|
47
|
+
@occupations.should respond_to(:last)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'is a Verso::OccupationData object' do
|
51
|
+
@occupations.last.should be_a(Verso::OccupationData)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '#length' do
|
56
|
+
it 'responds' do
|
57
|
+
@occupations.should respond_to(:length)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'is a Fixnum' do
|
61
|
+
@occupations.length.should be_a(Fixnum)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '#first' do
|
66
|
+
it 'responds' do
|
67
|
+
@occupations.should respond_to(:first)
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'is a Verso::OccupationData object' do
|
71
|
+
@occupations.first.should be_a(Verso::OccupationData)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#count' do
|
76
|
+
it 'responds' do
|
77
|
+
@occupations.should respond_to(:count)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'is a Fixnum' do
|
81
|
+
@occupations.count.should be_a(Fixnum)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'returns an empty array if the search is empty' do
|
87
|
+
Verso::OccupationList.new.should be_empty
|
88
|
+
end
|
89
|
+
|
4
90
|
it "searches by text" do
|
5
|
-
|
6
|
-
|
7
|
-
and_return(
|
8
|
-
JSON.pretty_generate(
|
9
|
-
{ :occupation_data => [{
|
10
|
-
:cluster => { :title => "Education and Training" },
|
11
|
-
:pathway => { :title => "Teaching and Training" },
|
12
|
-
:occupations => [
|
13
|
-
{ :title => "Elementary School Teacher" }
|
14
|
-
]
|
15
|
-
}] }
|
16
|
-
)
|
17
|
-
)
|
18
|
-
results = Verso::OccupationList.new(:text => "teacher")
|
19
|
-
results.first.occupations.first.title.should eq("Elementary School Teacher")
|
91
|
+
results = Verso::OccupationList.new(:text => "golf")
|
92
|
+
results.first.occupations.first.title.should match(/Turf/)
|
20
93
|
end
|
21
94
|
end
|
data/spec/occupation_spec.rb
CHANGED
@@ -1,41 +1,85 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Verso::Occupation do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
@occupation = Verso::Occupation.new(@raw_occupation)
|
4
|
+
use_vcr_cassette :record => :new_episodes
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@occ = Verso::OccupationList.new(:text => "golf").first.occupations.first
|
9
8
|
end
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
describe '#description' do
|
11
|
+
it 'responds' do
|
12
|
+
@occ.should respond_to(:description)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'is a String' do
|
16
|
+
@occ.description.should be_a(String)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'is HTML' do
|
20
|
+
@occ.description.should match(/<\/.+>/)
|
21
|
+
end
|
13
22
|
end
|
14
23
|
|
15
|
-
|
16
|
-
|
24
|
+
describe '#id' do
|
25
|
+
it 'responds' do
|
26
|
+
@occ.should respond_to(:id)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'is a Fixnum' do
|
30
|
+
@occ.id.should be_a(Fixnum)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'is not the same as #object_id' do
|
34
|
+
@occ.id.should_not == @occ.object_id
|
35
|
+
end
|
17
36
|
end
|
18
37
|
|
19
|
-
|
20
|
-
|
38
|
+
describe '#pathway' do
|
39
|
+
it 'responds' do
|
40
|
+
@occ.should respond_to(:pathway)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'is a Verso::Pathway' do
|
44
|
+
@occ.pathway.should be_a(Verso::Pathway)
|
45
|
+
end
|
21
46
|
end
|
22
47
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
@
|
48
|
+
describe '#preparations' do
|
49
|
+
it 'responds' do
|
50
|
+
@occ.should respond_to(:preparations)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'is an Array' do
|
54
|
+
@occ.preparations.should be_a(Array)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'is an Array of Strings' do
|
58
|
+
@occ.preparations.first.should be_a(String)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#related_courses' do
|
63
|
+
it 'responds' do
|
64
|
+
@occ.should respond_to(:related_courses)
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'is an Array' do
|
68
|
+
@occ.related_courses.should be_a(Array)
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'is an Array of Verso::Course objects' do
|
72
|
+
@occ.related_courses.first.should be_a(Verso::Course)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe '#title' do
|
77
|
+
it 'responds' do
|
78
|
+
@occ.should respond_to(:title)
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'is a String' do
|
82
|
+
@occ.title.should be_a(String)
|
83
|
+
end
|
40
84
|
end
|
41
85
|
end
|
data/spec/pathway_spec.rb
CHANGED
@@ -1,41 +1,61 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Verso::Pathway do
|
4
|
+
use_vcr_cassette :record => :new_episodes
|
5
|
+
|
4
6
|
before do
|
5
|
-
@
|
6
|
-
"id" => 49 }
|
7
|
-
@raw_pathway = { "title" => "Agribusiness Systems", "id" => 306 ,
|
8
|
-
"cluster" => @raw_cluster }
|
9
|
-
@pathway = Verso::Pathway.new(@raw_pathway)
|
7
|
+
@pathway = Verso::ClusterList.new.first.pathways.first
|
10
8
|
end
|
11
9
|
|
12
|
-
|
13
|
-
|
10
|
+
describe '#cluster' do
|
11
|
+
it 'responds' do
|
12
|
+
@pathway.should respond_to(:cluster)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'is a Verso::Cluster' do
|
16
|
+
@pathway.cluster.should be_a(Verso::Cluster)
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
16
|
-
|
17
|
-
|
20
|
+
describe '#description' do
|
21
|
+
it 'responds' do
|
22
|
+
@pathway.should respond_to(:description)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'is a String' do
|
26
|
+
@pathway.description.should be_a(String)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'is HTML' do
|
30
|
+
@pathway.description.should match(/<\/.+>/)
|
31
|
+
end
|
18
32
|
end
|
19
33
|
|
20
|
-
|
21
|
-
|
34
|
+
describe '#id' do
|
35
|
+
it 'responds' do
|
36
|
+
@pathway.should respond_to(:id)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'is a Fixnum' do
|
40
|
+
@pathway.id.should be_a(Fixnum)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'is not the same as #object_id' do
|
44
|
+
@pathway.id.should_not == @pathway.object_id
|
45
|
+
end
|
22
46
|
end
|
23
47
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
}
|
37
|
-
)
|
38
|
-
)
|
39
|
-
@pathway.occupations.first.title.should eq('Agricultural Commodity Broker')
|
48
|
+
describe '#occupations' do
|
49
|
+
it 'responds' do
|
50
|
+
@pathway.should respond_to(:occupations)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'is an Array' do
|
54
|
+
@pathway.occupations.should be_a(Array)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'is an Array containing Verso::Occupation objects' do
|
58
|
+
@pathway.occupations.first.should be_a(Verso::Occupation)
|
59
|
+
end
|
40
60
|
end
|
41
61
|
end
|
@@ -3,9 +3,83 @@ require 'spec_helper'
|
|
3
3
|
describe Verso::ProgramAreaList do
|
4
4
|
use_vcr_cassette :record => :new_episodes
|
5
5
|
|
6
|
-
|
7
|
-
list = Verso::ProgramAreaList.new
|
8
|
-
|
9
|
-
|
6
|
+
before do
|
7
|
+
@list = Verso::ProgramAreaList.new
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#[]' do
|
11
|
+
it 'responds' do
|
12
|
+
@list.should respond_to(:[])
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'is a Verso::ProgramArea object' do
|
16
|
+
@list[3].should be_a(Verso::ProgramArea)
|
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::ProgramArea objects' do
|
30
|
+
@list.each do |c|
|
31
|
+
c.should be_a(Verso::ProgramArea)
|
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::ProgramArea object' do
|
52
|
+
@list.last.should be_a(Verso::ProgramArea)
|
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 a Fixnum' do
|
62
|
+
@list.length.should be_a(Fixnum)
|
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::ProgramArea object' do
|
72
|
+
@list.first.should be_a(Verso::ProgramArea)
|
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 a Fixnum' do
|
82
|
+
@list.count.should be_a(Fixnum)
|
83
|
+
end
|
10
84
|
end
|
11
85
|
end
|
data/spec/program_area_spec.rb
CHANGED
@@ -1,39 +1,87 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Verso::ProgramArea do
|
4
|
+
use_vcr_cassette :record => :new_episodes
|
5
|
+
|
4
6
|
before do
|
5
7
|
@pa = Verso::ProgramArea.new("title" => "Career Connections")
|
6
8
|
end
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
+
describe '#courses' do
|
11
|
+
it 'responds' do
|
12
|
+
@pa.should respond_to(:courses)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'is an Array' do
|
16
|
+
@pa.courses.should be_a(Array)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'is an Array of Verso::Course objects' do
|
20
|
+
@pa.courses.first.should be_a(Verso::Course)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#deprecated' do
|
25
|
+
it 'responds' do
|
26
|
+
@pa.should respond_to(:deprecated)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'is Boolean' do
|
30
|
+
@pa.deprecated.to_s.should match(/true|false/)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#description' do
|
35
|
+
it 'responds' do
|
36
|
+
@pa.should respond_to(:description)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'is a String' do
|
40
|
+
@pa.description.should be_a(String)
|
41
|
+
end
|
10
42
|
end
|
11
43
|
|
12
|
-
|
13
|
-
|
44
|
+
describe '#section_overview' do
|
45
|
+
it 'responds' do
|
46
|
+
@pa.should respond_to(:section_overview)
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'is a String' do
|
50
|
+
@pa.section_overview.should be_a(String)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'is HTML' do
|
54
|
+
@pa.section_overview.should match(/<\/.+>/)
|
55
|
+
end
|
14
56
|
end
|
15
57
|
|
16
|
-
|
17
|
-
|
58
|
+
describe '#slug' do
|
59
|
+
it 'responds' do
|
60
|
+
@pa.should respond_to(:slug)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'is a string' do
|
64
|
+
@pa.slug.should be_a(String)
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'looks like the title' do
|
68
|
+
@pa.slug.should == 'career-connections'
|
69
|
+
end
|
18
70
|
end
|
19
71
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
72
|
+
describe '#title' do
|
73
|
+
it 'responds' do
|
74
|
+
@pa.should respond_to(:title)
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'is a String' do
|
78
|
+
@pa.title.should be_a(String)
|
79
|
+
end
|
27
80
|
end
|
28
81
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
"title" => "Career Connections",
|
34
|
-
"deprecated" => false
|
35
|
-
} ] }.to_json
|
36
|
-
)
|
37
|
-
@pa.deprecated.should eq(false)
|
82
|
+
describe '#version_date' do
|
83
|
+
it 'responds' do
|
84
|
+
@pa.should respond_to(:version_date)
|
85
|
+
end
|
38
86
|
end
|
39
87
|
end
|