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/task_spec.rb
CHANGED
@@ -1,55 +1,142 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Verso::Task do
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
use_vcr_cassette :record => :new_episodes
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@task = Verso::CourseList.new(:code => "6320").
|
8
|
+
last.
|
9
|
+
duty_areas.
|
10
|
+
last.
|
11
|
+
tasks.
|
12
|
+
first
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#code' do
|
16
|
+
it 'responds' do
|
17
|
+
@task.should respond_to(:code)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'is a String' do
|
21
|
+
@task.code.should be_a(String)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#definition' do
|
26
|
+
it 'responds' do
|
27
|
+
@task.should respond_to(:definition)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'is a Sring' do
|
31
|
+
@task.definition.should be_a(String)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'looks like HTML' do
|
35
|
+
@task.definition.should match(/<\/.+>/)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '#edition' do
|
40
|
+
it 'responds' do
|
41
|
+
@task.should respond_to(:edition)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'is a String' do
|
45
|
+
@task.edition.should be_a(String)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#essential' do
|
50
|
+
it 'responds' do
|
51
|
+
@task.should respond_to(:essential)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'is a Boolean' do
|
55
|
+
@task.essential.to_s.should match(/true|false/)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#essential?' do
|
60
|
+
it 'responds' do
|
61
|
+
@task.should respond_to(:essential?)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'is a Boolean' do
|
65
|
+
@task.essential?.to_s.should match(/true|false/)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe '#goals' do
|
70
|
+
it 'responds' do
|
71
|
+
@task.should respond_to(:goals)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'is a Verso::StandardsList' do
|
75
|
+
@task.goals.should be_a(Verso::StandardsList)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#id' do
|
80
|
+
it 'responds' do
|
81
|
+
@task.should respond_to(:id)
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'is a Fixnum' do
|
85
|
+
@task.id.should be_a(String)
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'is not the same as #object_id' do
|
89
|
+
@task.id.should_not == @task.object_id
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe '#questions' do
|
94
|
+
it 'responds' do
|
95
|
+
@task.should respond_to(:questions)
|
7
96
|
end
|
8
97
|
|
9
|
-
it
|
10
|
-
@task.
|
11
|
-
|
12
|
-
|
13
|
-
|
98
|
+
it 'is a String' do
|
99
|
+
@task.questions.should be_a(String)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe '#sensitive' do
|
104
|
+
it 'responds' do
|
105
|
+
@task.should respond_to(:sensitive)
|
14
106
|
end
|
15
107
|
|
16
|
-
it
|
17
|
-
@task.
|
18
|
-
Verso::StandardsList.should_receive(:new)
|
19
|
-
@task.standards
|
108
|
+
it 'is a Boolean' do
|
109
|
+
@task.sensitive.to_s.should match(/true|false/)
|
20
110
|
end
|
21
111
|
end
|
22
112
|
|
23
|
-
|
24
|
-
|
25
|
-
@
|
26
|
-
"description" => "A Description",
|
27
|
-
"goals" => [],
|
28
|
-
"sections" => [] } }
|
29
|
-
@task = Verso::Task.new("statement" => "Do this.", "id" => "12345",
|
30
|
-
"sensitive" => false, "essential" => true,
|
31
|
-
"goals" => @goals)
|
113
|
+
describe '#sensitive?' do
|
114
|
+
it 'responds' do
|
115
|
+
@task.should respond_to(:sensitive?)
|
32
116
|
end
|
33
117
|
|
34
|
-
it
|
35
|
-
@task.
|
118
|
+
it 'is a Boolean' do
|
119
|
+
@task.sensitive?.to_s.should match(/true|false/)
|
36
120
|
end
|
121
|
+
end
|
37
122
|
|
38
|
-
|
39
|
-
|
123
|
+
describe '#standards' do
|
124
|
+
it 'responds' do
|
125
|
+
@task.should respond_to(:standards)
|
40
126
|
end
|
41
|
-
|
42
|
-
|
127
|
+
|
128
|
+
it 'is a Verso::StandardsList' do
|
129
|
+
@task.standards.should be_a(Verso::StandardsList)
|
43
130
|
end
|
131
|
+
end
|
44
132
|
|
45
|
-
|
46
|
-
|
133
|
+
describe '#statement' do
|
134
|
+
it 'responds' do
|
135
|
+
@task.should respond_to(:statement)
|
47
136
|
end
|
48
137
|
|
49
|
-
it
|
50
|
-
@
|
51
|
-
Verso::StandardsList.should_receive(:new).with(@goals).and_return([@standard])
|
52
|
-
@task.standards.first.title.should eq("A Body")
|
138
|
+
it 'is a String' do
|
139
|
+
@task.statement.should be_a(String)
|
53
140
|
end
|
54
141
|
end
|
55
142
|
end
|
data/verso.gemspec
CHANGED
@@ -20,8 +20,10 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_runtime_dependency 'json'
|
21
21
|
s.add_runtime_dependency 'addressable'
|
22
22
|
s.add_development_dependency "fakeweb"
|
23
|
+
s.add_development_dependency "redcarpet"
|
23
24
|
s.add_development_dependency "rspec"
|
24
25
|
s.add_development_dependency "vcr"
|
26
|
+
s.add_development_dependency "yard"
|
25
27
|
|
26
|
-
s.required_ruby_version = '>= 1.
|
28
|
+
s.required_ruby_version = '>= 1.8.7'
|
27
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: verso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement: &
|
16
|
+
requirement: &70112552508440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70112552508440
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: addressable
|
27
|
-
requirement: &
|
27
|
+
requirement: &70112552507920 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70112552507920
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: fakeweb
|
38
|
-
requirement: &
|
38
|
+
requirement: &70112552507480 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,21 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70112552507480
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: redcarpet
|
49
|
+
requirement: &70112552506920 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70112552506920
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: rspec
|
49
|
-
requirement: &
|
60
|
+
requirement: &70112552506320 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ! '>='
|
@@ -54,10 +65,21 @@ dependencies:
|
|
54
65
|
version: '0'
|
55
66
|
type: :development
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *70112552506320
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: vcr
|
60
|
-
requirement: &
|
71
|
+
requirement: &70112552505820 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70112552505820
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: yard
|
82
|
+
requirement: &70112552505220 !ruby/object:Gem::Requirement
|
61
83
|
none: false
|
62
84
|
requirements:
|
63
85
|
- - ! '>='
|
@@ -65,7 +87,7 @@ dependencies:
|
|
65
87
|
version: '0'
|
66
88
|
type: :development
|
67
89
|
prerelease: false
|
68
|
-
version_requirements: *
|
90
|
+
version_requirements: *70112552505220
|
69
91
|
description: A Ruby wrapper for the Virginia CTE Resource Center's Web API
|
70
92
|
email:
|
71
93
|
- himself@leecapps.com
|
@@ -79,6 +101,7 @@ files:
|
|
79
101
|
- README.md
|
80
102
|
- Rakefile
|
81
103
|
- lib/verso.rb
|
104
|
+
- lib/verso/base.rb
|
82
105
|
- lib/verso/cluster.rb
|
83
106
|
- lib/verso/cluster_list.rb
|
84
107
|
- lib/verso/correlation_list.rb
|
@@ -94,14 +117,14 @@ files:
|
|
94
117
|
- lib/verso/extra.rb
|
95
118
|
- lib/verso/extras_list.rb
|
96
119
|
- lib/verso/frontmatter.rb
|
97
|
-
- lib/verso/
|
120
|
+
- lib/verso/hash.rb
|
121
|
+
- lib/verso/http_gettable.rb
|
98
122
|
- lib/verso/occupation.rb
|
99
123
|
- lib/verso/occupation_data.rb
|
100
124
|
- lib/verso/occupation_list.rb
|
101
125
|
- lib/verso/pathway.rb
|
102
126
|
- lib/verso/program_area.rb
|
103
127
|
- lib/verso/program_area_list.rb
|
104
|
-
- lib/verso/sol_correlation_list.rb
|
105
128
|
- lib/verso/standard.rb
|
106
129
|
- lib/verso/standards_list.rb
|
107
130
|
- lib/verso/task.rb
|
@@ -122,13 +145,13 @@ files:
|
|
122
145
|
- spec/extra_spec.rb
|
123
146
|
- spec/extras_list_spec.rb
|
124
147
|
- spec/frontmatter_spec.rb
|
148
|
+
- spec/hash_spec.rb
|
125
149
|
- spec/occupation_data_spec.rb
|
126
150
|
- spec/occupation_list_spec.rb
|
127
151
|
- spec/occupation_spec.rb
|
128
152
|
- spec/pathway_spec.rb
|
129
153
|
- spec/program_area_list_spec.rb
|
130
154
|
- spec/program_area_spec.rb
|
131
|
-
- spec/sol_correlation_list_spec.rb
|
132
155
|
- spec/spec_helper.rb
|
133
156
|
- spec/standard_spec.rb
|
134
157
|
- spec/standards_list_spec.rb
|
@@ -146,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
169
|
requirements:
|
147
170
|
- - ! '>='
|
148
171
|
- !ruby/object:Gem::Version
|
149
|
-
version: 1.
|
172
|
+
version: 1.8.7
|
150
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
174
|
none: false
|
152
175
|
requirements:
|
@@ -175,15 +198,16 @@ test_files:
|
|
175
198
|
- spec/extra_spec.rb
|
176
199
|
- spec/extras_list_spec.rb
|
177
200
|
- spec/frontmatter_spec.rb
|
201
|
+
- spec/hash_spec.rb
|
178
202
|
- spec/occupation_data_spec.rb
|
179
203
|
- spec/occupation_list_spec.rb
|
180
204
|
- spec/occupation_spec.rb
|
181
205
|
- spec/pathway_spec.rb
|
182
206
|
- spec/program_area_list_spec.rb
|
183
207
|
- spec/program_area_spec.rb
|
184
|
-
- spec/sol_correlation_list_spec.rb
|
185
208
|
- spec/spec_helper.rb
|
186
209
|
- spec/standard_spec.rb
|
187
210
|
- spec/standards_list_spec.rb
|
188
211
|
- spec/task_list_spec.rb
|
189
212
|
- spec/task_spec.rb
|
213
|
+
has_rdoc:
|
data/lib/verso/http_get.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
module Verso
|
2
|
-
class SOLCorrelationList
|
3
|
-
include Enumerable
|
4
|
-
include HTTPGet
|
5
|
-
|
6
|
-
def initialize(context)
|
7
|
-
@context = context
|
8
|
-
end
|
9
|
-
|
10
|
-
def code
|
11
|
-
@context.code
|
12
|
-
end
|
13
|
-
|
14
|
-
def edition
|
15
|
-
@context.edition
|
16
|
-
end
|
17
|
-
|
18
|
-
def tasklist
|
19
|
-
@context.duty_areas
|
20
|
-
end
|
21
|
-
|
22
|
-
def sol_names
|
23
|
-
@sol_names ||= @context.standards.sols.collect { |s| s.name }
|
24
|
-
end
|
25
|
-
|
26
|
-
def correlations
|
27
|
-
@correlations ||= sol_names.collect do |name|
|
28
|
-
JSON.parse(
|
29
|
-
http_get("/courses/#{code},#{edition}/standards/#{name}/correlations")
|
30
|
-
)["correlations"]
|
31
|
-
end.flatten
|
32
|
-
end
|
33
|
-
|
34
|
-
def each &block
|
35
|
-
count = 0
|
36
|
-
tasklist.each do |da|
|
37
|
-
da.tasks.each do |task|
|
38
|
-
count += 1
|
39
|
-
related = correlations.find_all { |c| c["id"] == task.id }
|
40
|
-
if related.empty?
|
41
|
-
next
|
42
|
-
else
|
43
|
-
related[1,related.count].each do |c|
|
44
|
-
related.first["goals"].merge!(c["goals"])
|
45
|
-
end
|
46
|
-
related.first["number"] = count
|
47
|
-
yield Task.new(related.first)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Verso::SOLCorrelationList do
|
4
|
-
before do
|
5
|
-
@goal = OpenStruct.new({ "title" => "goal title",
|
6
|
-
"description" => "goal description" })
|
7
|
-
@standard = double("Standard", :title => "standard title",
|
8
|
-
:description => "standard description",
|
9
|
-
:goals => [@goal], :sections => [])
|
10
|
-
@standards_list = [@standard]
|
11
|
-
@standards_list.stub(:sols).
|
12
|
-
and_return([OpenStruct.new(:name => "english"),
|
13
|
-
OpenStruct.new(:name => "science")])
|
14
|
-
@task = double("Task", :statement => "task statement", :id => "111",
|
15
|
-
:standards => @standards_list)
|
16
|
-
@tasks = [@task]
|
17
|
-
@duty_areas = [OpenStruct.new(:tasks => @tasks)]
|
18
|
-
@course = double("Course", :title => "course title", :edition => "1929",
|
19
|
-
:code => "0000", :duration => 36, :hours => nil,
|
20
|
-
:co_op => true, :related_resources => ["tasks"],
|
21
|
-
:standards => @standards_list,
|
22
|
-
:duty_areas => @duty_areas, :certifications => [])
|
23
|
-
correlations1 = { "correlations" => [
|
24
|
-
{"id" => "111", "statement" => "task statement",
|
25
|
-
"goals" => {
|
26
|
-
"english" => { "title" => "English", "description" => "",
|
27
|
-
"sections" => [],
|
28
|
-
"goals" => [
|
29
|
-
{ "title" => "english goal title",
|
30
|
-
"description" => "english goal description" }
|
31
|
-
] }
|
32
|
-
}
|
33
|
-
}
|
34
|
-
]}.to_json
|
35
|
-
correlations2 = { "correlations" => [
|
36
|
-
{"id" => "111", "statement" => "task statement",
|
37
|
-
"goals" => {
|
38
|
-
"science" => { "title" => "Science", "description" => "",
|
39
|
-
"sections" => [],
|
40
|
-
"goals" => [
|
41
|
-
{ "title" => "science goal title",
|
42
|
-
"description" => "science goal description" }
|
43
|
-
] }
|
44
|
-
}
|
45
|
-
}
|
46
|
-
]}.to_json
|
47
|
-
@correlations = Verso::SOLCorrelationList.new(@course)
|
48
|
-
Net::HTTP.should_receive(:get).
|
49
|
-
with('api.cteresource.org',
|
50
|
-
"/courses/#{@course.code},#{@course.edition}/standards/english/correlations",
|
51
|
-
80).
|
52
|
-
and_return(correlations1)
|
53
|
-
Net::HTTP.should_receive(:get).
|
54
|
-
with('api.cteresource.org',
|
55
|
-
"/courses/#{@course.code},#{@course.edition}/standards/science/correlations",
|
56
|
-
80).
|
57
|
-
and_return(correlations2)
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'is enumerable' do
|
61
|
-
@correlations.first.statement.should eq('task statement')
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'numbers the correlations' do
|
65
|
-
@correlations.first.number.should eq(1)
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'compiles the goals' do
|
69
|
-
@correlations.first.standards.count.should eq(2)
|
70
|
-
titles = @correlations.first.standards.collect { |s| s.title }
|
71
|
-
titles.first.should eq('English')
|
72
|
-
titles.last.should eq('Science')
|
73
|
-
end
|
74
|
-
end
|