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
data/spec/standard_spec.rb
CHANGED
@@ -1,53 +1,111 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Verso::Standard do
|
4
|
+
use_vcr_cassette :record => :new_episodes
|
5
|
+
|
4
6
|
before do
|
5
|
-
@
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
"description" => "section description",
|
11
|
-
"goals" => [@nested_goal], "sections" => [] }
|
12
|
-
@raw_standard = { :aname => { "title" => "standard title",
|
13
|
-
"description" => "standard description",
|
14
|
-
"goals" => [@goal],
|
15
|
-
"sections" => [@section] } }
|
16
|
-
@standard = Verso::Standard.new(@raw_standard.values.first)
|
7
|
+
@standard = Verso::Standard.new(
|
8
|
+
:code => "6135",
|
9
|
+
:edition => Verso::EditionList.new.last.year,
|
10
|
+
:name => "english"
|
11
|
+
)
|
17
12
|
end
|
18
13
|
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
describe '#description' do
|
15
|
+
it 'responds' do
|
16
|
+
@standard.should respond_to(:description)
|
17
|
+
end
|
22
18
|
|
23
|
-
|
24
|
-
|
19
|
+
it 'is a string' do
|
20
|
+
@standard.description.should be_a(String)
|
21
|
+
end
|
25
22
|
end
|
26
23
|
|
27
|
-
|
28
|
-
|
24
|
+
describe '#goals' do
|
25
|
+
it 'responds' do
|
26
|
+
@standard.should respond_to(:goals)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'is an Array' do
|
30
|
+
@standard.goals.should be_a(Array)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'is an Array of OpenStruct objects' do
|
34
|
+
@standard.goals.first.should be_a(OpenStruct)
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'OpenStruct goal objects' do
|
38
|
+
before do
|
39
|
+
@goal = @standard.goals.first
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#title' do
|
43
|
+
it 'responds' do
|
44
|
+
@goal.should respond_to(:title)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'is a string' do
|
48
|
+
@goal.title.should be_a(String)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#description' do
|
53
|
+
it 'responds' do
|
54
|
+
@goal.should respond_to(:description)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'is a String' do
|
58
|
+
@goal.description.should be_a(String)
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'looks like HTML' do
|
62
|
+
@goal.description.should match(/<\/.+>/)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
29
66
|
end
|
30
67
|
|
31
|
-
|
32
|
-
|
68
|
+
describe '#name' do
|
69
|
+
it 'responds' do
|
70
|
+
@standard.should respond_to(:name)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'is a String' do
|
74
|
+
@standard.name.should be_a(String)
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'looks like the title' do
|
78
|
+
@standard.name.should == 'english'
|
79
|
+
end
|
33
80
|
end
|
34
81
|
|
35
|
-
|
36
|
-
|
82
|
+
describe '#sections' do
|
83
|
+
it 'responds' do
|
84
|
+
@standard.should respond_to(:sections)
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'is an Array' do
|
88
|
+
@standard.sections.should be_a(Array)
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'is an Array of Verso::Standard objects' do
|
92
|
+
# english doesn't have subsections, so . . .
|
93
|
+
std = Verso::Standard.new(
|
94
|
+
:code => "8276",
|
95
|
+
:edition => Verso::EditionList.new.last.year,
|
96
|
+
:name => 'fccla_activities--competitive_events'
|
97
|
+
)
|
98
|
+
std.sections.first.should be_a(Verso::Standard)
|
99
|
+
end
|
37
100
|
end
|
38
101
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
"goals" => [] } }
|
48
|
-
Net::HTTP.stub(:get).and_return(nil)
|
49
|
-
JSON.stub(:parse).and_return(raw_std)
|
50
|
-
std.title.should eq("Science")
|
51
|
-
std.name.should eq("science")
|
102
|
+
describe '#title' do
|
103
|
+
it 'responds' do
|
104
|
+
@standard.should respond_to(:title)
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'is a String' do
|
108
|
+
@standard.title.should be_a(String)
|
109
|
+
end
|
52
110
|
end
|
53
111
|
end
|
data/spec/standards_list_spec.rb
CHANGED
@@ -1,51 +1,145 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Verso::StandardsList do
|
4
|
+
use_vcr_cassette :record => :new_episodes
|
5
|
+
|
4
6
|
before do
|
5
|
-
@
|
6
|
-
|
7
|
-
|
8
|
-
{ "title" => "nested goal title",
|
9
|
-
"description" => "nested goal description" }
|
10
|
-
)
|
11
|
-
@section = OpenStruct.new(
|
12
|
-
{ "title" => "section title", "description" => "section description",
|
13
|
-
"goals" => [@nested_goal], "sections" => [] }
|
7
|
+
@list = Verso::StandardsList.new(
|
8
|
+
:code => "6320",
|
9
|
+
:edition => Verso::EditionList.new.last.year
|
14
10
|
)
|
15
|
-
@raw_standard = { :aname => { "title" => "standard title",
|
16
|
-
"description" => "standard description",
|
17
|
-
"goals" => [@goal],
|
18
|
-
"sections" => [@section] } }
|
19
|
-
sol = { :science => { "title" => "Science",
|
20
|
-
"description" => "standard description",
|
21
|
-
"name" => "science",
|
22
|
-
"goals" => [@goal],
|
23
|
-
"sections" => [@section] } }
|
24
|
-
@raw_standard.merge!(sol)
|
25
|
-
@standards_list = Verso::StandardsList.new(@raw_standard)
|
26
11
|
end
|
27
12
|
|
28
|
-
|
29
|
-
|
30
|
-
|
13
|
+
describe 'array-like behavior' do
|
14
|
+
describe '#[]' do
|
15
|
+
it 'responds' do
|
16
|
+
@list.should respond_to(:[])
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'gets a Verso::Standard object' do
|
20
|
+
@list[2].should be_a(Verso::Standard)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#each' do
|
25
|
+
it 'responds' do
|
26
|
+
@list.should respond_to(:each)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'yields' do
|
30
|
+
expect { |b| @list.each("foo", &b).to yield_control }
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'yields Verso::Standard objects' do
|
34
|
+
@list.each { |c| c.should be_a(Verso::Standard) }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#empty?' do
|
39
|
+
it 'responds' do
|
40
|
+
@list.should respond_to(:empty?)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'is not empty' do
|
44
|
+
@list.should_not be_empty
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#last' do
|
49
|
+
it 'responds' do
|
50
|
+
@list.should respond_to(:last)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'is a Verso::Standard object' do
|
54
|
+
@list.last.should be_a(Verso::Standard)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#length' do
|
59
|
+
it 'responds' do
|
60
|
+
@list.should respond_to(:length)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'is a Fixnum' do
|
64
|
+
@list.length.should be_a(Fixnum)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe '#first' do
|
69
|
+
it 'responds' do
|
70
|
+
@list.should respond_to(:first)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'is a Verso::Standard object' do
|
74
|
+
@list.first.should be_a(Verso::Standard)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe '#count' do
|
79
|
+
it 'responds' do
|
80
|
+
@list.should respond_to(:count)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'is a Fixnum' do
|
84
|
+
@list.count.should be_a(Fixnum)
|
85
|
+
end
|
86
|
+
end
|
31
87
|
end
|
32
88
|
|
33
|
-
|
34
|
-
|
89
|
+
describe '#non_sols' do
|
90
|
+
it 'responds' do
|
91
|
+
@list.should respond_to(:non_sols)
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'is an Array' do
|
95
|
+
@list.non_sols.should be_a(Array)
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'is an Array of Verso::Standard Objects' do
|
99
|
+
@list.non_sols.first.should be_a(Verso::Standard)
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'does not include SOLs like English' do
|
103
|
+
@list.non_sols.any? { |s| s.title == 'English'}.should be_false
|
104
|
+
end
|
35
105
|
end
|
36
106
|
|
37
|
-
|
38
|
-
|
107
|
+
describe '#sols' do
|
108
|
+
it 'responds' do
|
109
|
+
@list.should respond_to(:sols)
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'is an Array' do
|
113
|
+
@list.sols.should be_a(Array)
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'is an Array of Verso::Standard Objects' do
|
117
|
+
@list.sols.first.should be_a(Verso::Standard)
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'includes SOLs like English' do
|
121
|
+
@list.sols.any? { |s| s.title == 'English' }.should be_true
|
122
|
+
end
|
39
123
|
end
|
40
124
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
125
|
+
describe 'self.from_course' do
|
126
|
+
before do
|
127
|
+
@course = Verso::CourseList.new(:code => "6320").last
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'responds' do
|
131
|
+
Verso::StandardsList.should respond_to(:from_course)
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'returns a Verso::StandardsList' do
|
135
|
+
Verso::StandardsList.from_course(@course).
|
136
|
+
should be_a(Verso::StandardsList)
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'has the correct code and edition' do
|
140
|
+
list = Verso::StandardsList.from_course(@course)
|
141
|
+
list.code.should == @course.code
|
142
|
+
list.edition.should == @course.edition
|
143
|
+
end
|
50
144
|
end
|
51
145
|
end
|
data/spec/task_list_spec.rb
CHANGED
@@ -4,69 +4,178 @@ describe Verso::TaskList do
|
|
4
4
|
use_vcr_cassette :record => :new_episodes
|
5
5
|
|
6
6
|
before do
|
7
|
-
@tl = Verso::TaskList.new(
|
7
|
+
@tl = Verso::TaskList.new(
|
8
|
+
:code => "6320",
|
9
|
+
:edition => Verso::EditionList.new.last.year)
|
8
10
|
end
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
12
|
+
describe '#code' do
|
13
|
+
it 'responds' do
|
14
|
+
@tl.should respond_to(:code)
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
it 'is a String' do
|
18
|
+
@tl.code.should be_a(String)
|
19
|
+
end
|
19
20
|
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
)
|
30
|
-
@tl.has_optional_task?.should eq(false)
|
22
|
+
describe '#edition' do
|
23
|
+
it 'responds' do
|
24
|
+
@tl.should respond_to(:edition)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'is a String' do
|
28
|
+
@tl.edition.should be_a(String)
|
29
|
+
end
|
31
30
|
end
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
32
|
+
describe '#has_optional_task?' do
|
33
|
+
it 'responds' do
|
34
|
+
@tl.should respond_to(:has_optional_task?)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'is Boolean' do
|
38
|
+
@tl.has_optional_task?.to_s.should match(/true|false/)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'is true if a task is non-essential' do
|
42
|
+
tl = Verso::TaskList.new(
|
43
|
+
:code => "6320",
|
44
|
+
:edition => Verso::EditionList.new.last.year,
|
45
|
+
:duty_areas => [
|
46
|
+
{ :title => "",
|
47
|
+
:tasks => [
|
48
|
+
{ :statement => '', :id => "12",
|
49
|
+
:sensitive => false, :essential => false }
|
50
|
+
]
|
51
|
+
}]
|
52
|
+
)
|
53
|
+
tl.has_optional_task?.should be_true
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'is false if all tasks are essential' do
|
57
|
+
tl = Verso::TaskList.new(
|
58
|
+
:code => "6320",
|
59
|
+
:edition => Verso::EditionList.new.last.year,
|
60
|
+
:duty_areas => [
|
61
|
+
{ :title => "",
|
62
|
+
:tasks => [
|
63
|
+
{ :statement => '', :id => "12",
|
64
|
+
:sensitive => false, :essential => true }
|
65
|
+
]
|
66
|
+
}]
|
67
|
+
)
|
68
|
+
tl.has_optional_task?.should be_false
|
69
|
+
end
|
43
70
|
end
|
44
71
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
72
|
+
describe '#has_sensitive_task?' do
|
73
|
+
it 'responds' do
|
74
|
+
@tl.should respond_to(:has_sensitive_task?)
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'is Boolean' do
|
78
|
+
@tl.has_sensitive_task?.to_s.should match(/true|false/)
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'is false if no task is sensitive' do
|
82
|
+
@tl.has_sensitive_task?.should be_false
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'is true if a task is sensitive' do
|
86
|
+
tl = Verso::TaskList.new(
|
87
|
+
:code => "6320",
|
88
|
+
:edition => Verso::EditionList.new.last.year,
|
89
|
+
:duty_areas => [
|
90
|
+
{ :title => "",
|
91
|
+
:tasks => [
|
92
|
+
{ :statement => '', :id => "12",
|
93
|
+
:sensitive => true, :essential => true }
|
94
|
+
]
|
95
|
+
}]
|
96
|
+
)
|
97
|
+
tl.has_sensitive_task?.should be_true
|
98
|
+
end
|
54
99
|
end
|
55
100
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
101
|
+
describe 'array-like behavior' do
|
102
|
+
describe '#[]' do
|
103
|
+
it 'responds' do
|
104
|
+
@tl.should respond_to(:[])
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'gets a Verso::DutyArea object' do
|
108
|
+
@tl[10].should be_a(Verso::DutyArea)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe '#each' do
|
113
|
+
it 'responds' do
|
114
|
+
@tl.should respond_to(:each)
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'yields' do
|
118
|
+
expect { |b| @tl.each("foo", &b).to yield_control }
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'yields Verso::DutyArea objects' do
|
122
|
+
@tl.each { |c| c.should be_a(Verso::DutyArea) }
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe '#empty?' do
|
127
|
+
it 'responds' do
|
128
|
+
@tl.should respond_to(:empty?)
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'is not empty' do
|
132
|
+
@tl.should_not be_empty
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
describe '#last' do
|
137
|
+
it 'responds' do
|
138
|
+
@tl.should respond_to(:last)
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'is a Verso::DutyArea object' do
|
142
|
+
@tl.last.should be_a(Verso::DutyArea)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
describe '#length' do
|
147
|
+
it 'responds' do
|
148
|
+
@tl.should respond_to(:length)
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'is a Fixnum' do
|
152
|
+
@tl.length.should be_a(Fixnum)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
describe '#first' do
|
157
|
+
it 'responds' do
|
158
|
+
@tl.should respond_to(:first)
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'is a Verso::DutyArea object' do
|
162
|
+
@tl.first.should be_a(Verso::DutyArea)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
describe '#count' do
|
167
|
+
it 'responds' do
|
168
|
+
@tl.should respond_to(:count)
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'is a Fixnum' do
|
172
|
+
@tl.count.should be_a(Fixnum)
|
173
|
+
end
|
174
|
+
end
|
65
175
|
end
|
66
176
|
|
67
|
-
it "
|
68
|
-
|
69
|
-
|
70
|
-
@tl.duty_areas.should eq([])
|
177
|
+
it "is empty if no task list is published" do
|
178
|
+
tl = Verso::TaskList.new(:code => "1234", :edition => "1929")
|
179
|
+
tl.should be_empty
|
71
180
|
end
|
72
181
|
end
|