verso 0.0.4 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/lib/verso.rb +2 -0
  2. data/lib/verso/cluster.rb +1 -5
  3. data/lib/verso/course.rb +1 -6
  4. data/lib/verso/duty_area.rb +3 -1
  5. data/lib/verso/error.rb +4 -0
  6. data/lib/verso/http_gettable.rb +6 -1
  7. data/lib/verso/occupation.rb +1 -0
  8. data/lib/verso/occupation_data.rb +3 -3
  9. data/lib/verso/pathway.rb +1 -0
  10. data/lib/verso/program_area.rb +1 -11
  11. data/lib/verso/sluggable.rb +18 -0
  12. data/lib/verso/standards_list.rb +6 -1
  13. data/lib/verso/task.rb +1 -1
  14. data/lib/verso/task_list.rb +1 -1
  15. data/lib/verso/version.rb +1 -1
  16. data/spec/cluster_list_spec.rb +1 -2
  17. data/spec/cluster_spec.rb +29 -4
  18. data/spec/correlation_list_spec.rb +1 -2
  19. data/spec/course_list_spec.rb +1 -2
  20. data/spec/course_spec.rb +1 -2
  21. data/spec/credential_list_spec.rb +1 -2
  22. data/spec/credential_spec.rb +1 -2
  23. data/spec/duty_area_spec.rb +15 -2
  24. data/spec/edition_list_spec.rb +1 -2
  25. data/spec/emphasis_list_spec.rb +1 -2
  26. data/spec/emphasis_spec.rb +1 -2
  27. data/spec/examination_list_spec.rb +1 -3
  28. data/spec/extra_spec.rb +1 -2
  29. data/spec/extras_list_spec.rb +1 -2
  30. data/spec/frontmatter_spec.rb +1 -2
  31. data/spec/occupation_data_spec.rb +31 -2
  32. data/spec/occupation_list_spec.rb +1 -2
  33. data/spec/occupation_spec.rb +15 -2
  34. data/spec/pathway_spec.rb +15 -2
  35. data/spec/program_area_list_spec.rb +1 -2
  36. data/spec/program_area_spec.rb +1 -2
  37. data/spec/spec_helper.rb +4 -11
  38. data/spec/standard_spec.rb +1 -2
  39. data/spec/standards_list_spec.rb +7 -2
  40. data/spec/task_list_spec.rb +1 -2
  41. data/spec/task_spec.rb +2 -3
  42. data/verso.gemspec +1 -1
  43. metadata +19 -17
data/lib/verso.rb CHANGED
@@ -6,9 +6,11 @@ require 'net/http'
6
6
  require 'ostruct'
7
7
 
8
8
  # base/mixin/override
9
+ require 'verso/error'
9
10
  require 'verso/base'
10
11
  require 'verso/hash'
11
12
  require 'verso/http_gettable'
13
+ require 'verso/sluggable'
12
14
 
13
15
  # resources and children
14
16
  require 'verso/cluster'
data/lib/verso/cluster.rb CHANGED
@@ -19,6 +19,7 @@ module Verso
19
19
  # @option attrs [Fixnum] :id Cluster id *Required*
20
20
  class Cluster < Verso::Base
21
21
  include HTTPGettable
22
+ include Sluggable
22
23
  attr_reader :code, :description, :id, :postsecondary_info
23
24
 
24
25
  # Return VDOE Cluster contact. The contact will respond to #name, #email,
@@ -49,11 +50,6 @@ module Verso
49
50
  collect { |p| Pathway.new(p) }
50
51
  end
51
52
 
52
- # @return [String] parameterized title
53
- def slug
54
- title.parameterize
55
- end
56
-
57
53
  # @return [String] Cluster title
58
54
  def title
59
55
  @title ||= attrs[:title] || attrs[:cluster][:title]
data/lib/verso/course.rb CHANGED
@@ -120,12 +120,7 @@ module Verso
120
120
  # @return [Verso::StandardsList] Standards bodies correlated to this
121
121
  # course's tasks.
122
122
  def standards
123
- @standards ||= if self.related_resources.include?("standards")
124
- StandardsList.from_course(self)
125
- else
126
- StandardsList.new(:code => code, :edition => edition,
127
- :standards => [])
128
- end
123
+ @standards ||= StandardsList.from_course(self)
129
124
  end
130
125
 
131
126
  # Fetch a complete task given a task id.
@@ -9,6 +9,8 @@ module Verso
9
9
  # @return [String] Course code
10
10
  # @!attribute [r] edition
11
11
  # @return [String] Course edition year
12
+ # @!attribute [r] id
13
+ # @return [String] DutyArea ID
12
14
  # @!attribute [r] title
13
15
  # @return [String] Duty Area title
14
16
  #
@@ -16,7 +18,7 @@ module Verso
16
18
  # to a portion of the Task List resource. You should never need to
17
19
  # instantiate one yourself.
18
20
  class DutyArea < Verso::Base
19
- attr_reader :code, :edition, :title
21
+ attr_reader :code, :edition, :id, :title
20
22
 
21
23
  # Tasks within this Duty Area
22
24
  #
@@ -0,0 +1,4 @@
1
+ module Verso
2
+ class ResourceNotFoundError < StandardError
3
+ end
4
+ end
@@ -20,7 +20,12 @@ module Verso
20
20
  # HTTP GET the JSON resource
21
21
  # @return [String] JSON resource
22
22
  def http_get
23
- Net::HTTP.get('api.cteresource.org', path, 80)
23
+ resp = Net::HTTP.get_response('api.cteresource.org', path, 80)
24
+ if resp.code != "200"
25
+ raise Verso::ResourceNotFoundError
26
+ else
27
+ resp.body
28
+ end
24
29
  end
25
30
 
26
31
  # @return [Hash] Resource hash
@@ -21,6 +21,7 @@ module Verso
21
21
  # @option attrs [Fixnum] :id Occupation ID *Required*
22
22
  class Occupation < Verso::Base
23
23
  include HTTPGettable
24
+ include Sluggable
24
25
  attr_reader :description, :id, :preparations, :title
25
26
 
26
27
  # @return [Verso::Pathway] Pathway that is the parent of this occupation
@@ -39,9 +39,9 @@ module Verso
39
39
  # @param [String] slug Occupation slug
40
40
  # @return [Verso::OccupationData,nil] Containing only one Occupation
41
41
  def self.find_by_slugs(cslug, pslug, slug)
42
- cluster = ClusterList.new.find { |c| c.title.parameterize == cslug }
43
- pathway = cluster.pathways.find { |p| p.title.parameterize == pslug }
44
- occupation = pathway.occupations.find { |o| o.title.parameterize == slug }
42
+ cluster = ClusterList.new.find { |c| c.slug== cslug }
43
+ pathway = cluster.pathways.find { |p| p.slug == pslug }
44
+ occupation = pathway.occupations.find { |o| o.slug == slug }
45
45
  OccupationData.new(
46
46
  { :cluster => { :title => cluster.title },
47
47
  :pathway => { :title => pathway.title },
data/lib/verso/pathway.rb CHANGED
@@ -17,6 +17,7 @@ module Verso
17
17
  # @option attrs [Fixnum] :id Pathway id *Required*
18
18
  class Pathway < Verso::Base
19
19
  include HTTPGettable
20
+ include Sluggable
20
21
  attr_reader :description, :id, :title
21
22
 
22
23
  # @return [Verso::Cluster] Parent Cluster
@@ -22,6 +22,7 @@ module Verso
22
22
  # @option attrs [String] :title Program Area title *Required*
23
23
  class ProgramArea < Verso::Base
24
24
  include HTTPGettable
25
+ include Sluggable
25
26
  attr_reader :deprecated, :official, :section_overview, :title, :version_date
26
27
 
27
28
  # @return [Array] Collection of related {Verso::Course} objects
@@ -36,17 +37,6 @@ module Verso
36
37
  ""
37
38
  end
38
39
 
39
- # @return [String] Parameterized title
40
- def slug
41
- # swiped from ActiveSupport::Inflector
42
- parameterized_string = title.dup
43
- parameterized_string.gsub!(/[^a-z0-9\-_]+/i, '-')
44
- re_sep = Regexp.escape('-')
45
- parameterized_string.gsub!(/#{re_sep}{2,}/, '-')
46
- parameterized_string.gsub!(/^#{re_sep}|#{re_sep}$/i, '')
47
- parameterized_string.downcase
48
- end
49
-
50
40
  private
51
41
 
52
42
  def path
@@ -0,0 +1,18 @@
1
+ module Verso
2
+ # Mixin for class, providing a slug method that returns a parameterized
3
+ # version of the title, a la ActiveSupport::Inflector's String#parameterize.
4
+ #
5
+ # @abstract Implement a title method that returns a string.
6
+ module Sluggable
7
+ # @return [String] Parameterized title
8
+ def slug
9
+ # swiped from ActiveSupport::Inflector
10
+ parameterized_string = title.dup
11
+ parameterized_string.gsub!(/[^a-z0-9\-_]+/i, '-')
12
+ re_sep = Regexp.escape('-')
13
+ parameterized_string.gsub!(/#{re_sep}{2,}/, '-')
14
+ parameterized_string.gsub!(/^#{re_sep}|#{re_sep}$/i, '')
15
+ parameterized_string.downcase
16
+ end
17
+ end
18
+ end
@@ -36,7 +36,12 @@ class StandardsList < Verso::Base
36
36
  # @param course [Verso::Course] A {Verso::Course}
37
37
  # @return [Verso::StandardsList] A {Verso::Course}'s standards
38
38
  def self.from_course(course)
39
- StandardsList.new(:code => course.code, :edition => course.edition)
39
+ if course.related_resources.include?("standards")
40
+ StandardsList.new(:code => course.code, :edition => course.edition)
41
+ else
42
+ StandardsList.new(:code => course.code, :edition => course.edition,
43
+ :standards => [])
44
+ end
40
45
  end
41
46
 
42
47
  private
data/lib/verso/task.rb CHANGED
@@ -11,7 +11,7 @@ module Verso
11
11
  # @!attribute [r] edition
12
12
  # @return [String] Course edition year
13
13
  # @!attribute [r] id
14
- # @return [Fixnum] Task ID
14
+ # @return [String] Task ID
15
15
  # @!attribute [r] sensitive
16
16
  # @return [Boolean] Is this task sensitive?
17
17
  # @!attribute [r] statement
@@ -42,7 +42,7 @@ module Verso
42
42
  da.merge!(:code => code, :edition => edition)
43
43
  )
44
44
  end
45
- rescue NameError
45
+ rescue NameError, Verso::ResourceNotFoundError
46
46
  []
47
47
  end
48
48
  end
data/lib/verso/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Verso
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_verso_list_examples'
3
3
 
4
- describe Verso::ClusterList do
5
- use_vcr_cassette :record => :new_episodes
4
+ describe Verso::ClusterList, :vcr do
6
5
 
7
6
  before(:each) do
8
7
  @list = Verso::ClusterList.new
data/spec/cluster_spec.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Verso::Cluster do
4
- use_vcr_cassette :record => :new_episodes
3
+ describe Verso::Cluster, :vcr do
5
4
 
6
5
  before(:each) do
7
6
  @cluster = Verso::ClusterList.new.first
@@ -16,8 +15,8 @@ describe Verso::Cluster do
16
15
  @cluster.code.should be_a(String)
17
16
  end
18
17
 
19
- it 'is formatted like CT1, CT2, etc.' do
20
- @cluster.code.should match(/CT\d+/)
18
+ it 'is formatted like 1, 2, etc.' do
19
+ @cluster.code.should match(/\d+/)
21
20
  end
22
21
  end
23
22
 
@@ -99,6 +98,20 @@ describe Verso::Cluster do
99
98
  end
100
99
  end
101
100
 
101
+ describe '#slug' do
102
+ it 'responds' do
103
+ @cluster.should respond_to(:slug)
104
+ end
105
+
106
+ it 'is a string' do
107
+ @cluster.slug.should be_a(String)
108
+ end
109
+
110
+ it 'looks like the title' do
111
+ @cluster.slug.should == 'agriculture-food-and-natural-resources'
112
+ end
113
+ end
114
+
102
115
  describe '#title' do
103
116
  it 'responds' do
104
117
  @cluster.should respond_to(:title)
@@ -112,4 +125,16 @@ describe Verso::Cluster do
112
125
  @cluster.title.should == 'Agriculture, Food and Natural Resources'
113
126
  end
114
127
  end
128
+
129
+ describe '#http_get' do
130
+ before do
131
+ @bad_cluster = Verso::Cluster.new(:id => 9999999999999999)
132
+ end
133
+
134
+ it 'raises ResourceNotFoundError when resource not found' do
135
+ expect { @bad_cluster.description }.to raise_error(
136
+ Verso::ResourceNotFoundError
137
+ )
138
+ end
139
+ end
115
140
  end
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_verso_list_examples'
3
3
 
4
- describe Verso::CorrelationList do
5
- use_vcr_cassette :record => :new_episodes
4
+ describe Verso::CorrelationList, :vcr do
6
5
 
7
6
  before(:each) do
8
7
  @list = Verso::CorrelationList.new(
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_verso_list_examples'
3
3
 
4
- describe Verso::CourseList do
5
- use_vcr_cassette :record => :new_episodes
4
+ describe Verso::CourseList, :vcr do
6
5
 
7
6
  describe 'search' do
8
7
  it "searches by code" do
data/spec/course_spec.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Verso::Course do
4
- use_vcr_cassette :record => :new_episodes
3
+ describe Verso::Course, :vcr do
5
4
 
6
5
  before do
7
6
  @course = Verso::Course.new(:code => "6321",
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_verso_list_examples'
3
3
 
4
- describe Verso::CredentialList do
5
- use_vcr_cassette :record => :new_episodes
4
+ describe Verso::CredentialList, :vcr do
6
5
  describe 'array-like behavior' do
7
6
  before(:each) do
8
7
  @list = Verso::CredentialList.new
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Verso::Credential do
4
- use_vcr_cassette :record => :new_episodes
3
+ describe Verso::Credential, :vcr do
5
4
  before do
6
5
  @credential = Verso::CredentialList.new.last
7
6
  end
@@ -1,12 +1,25 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Verso::DutyArea do
4
- use_vcr_cassette :record => :new_episodes
3
+ describe Verso::DutyArea, :vcr do
5
4
 
6
5
  before do
7
6
  @da = Verso::CourseList.new(:code => "6320").last.duty_areas.last
8
7
  end
9
8
 
9
+ describe '#id' do
10
+ it 'responds' do
11
+ @da.should respond_to(:id)
12
+ end
13
+
14
+ it 'is a String' do
15
+ @da.id.should be_a(String)
16
+ end
17
+
18
+ it 'looks like an id' do
19
+ @da.id.should match(/^\d+$/)
20
+ end
21
+ end
22
+
10
23
  describe '#code' do
11
24
  it "responds" do
12
25
  @da.should respond_to(:code)
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_verso_list_examples'
3
3
 
4
- describe Verso::EditionList do
5
- use_vcr_cassette :record => :new_episodes
4
+ describe Verso::EditionList, :vcr do
6
5
 
7
6
  before(:each) do
8
7
  @list = Verso::EditionList.new
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_verso_list_examples'
3
3
 
4
- describe Verso::EmphasisList do
5
- use_vcr_cassette :record => :new_episodes
4
+ describe Verso::EmphasisList, :vcr do
6
5
 
7
6
  before do
8
7
  @list = Verso::EmphasisList.new
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Verso::Emphasis do
4
- use_vcr_cassette :record => :new_episodes
3
+ describe Verso::Emphasis, :vcr do
5
4
 
6
5
  before do
7
6
  @emphasis = Verso::EmphasisList.new.last
@@ -1,9 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_verso_list_examples'
3
3
 
4
- describe Verso::ExaminationList do
5
- use_vcr_cassette :record => :new_episodes
6
-
4
+ describe Verso::ExaminationList, :vcr, :vcr do
7
5
  before(:each) do
8
6
  @list = Verso::ExaminationList.new
9
7
  @kontained = OpenStruct
data/spec/extra_spec.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Verso::Extra do
4
- use_vcr_cassette :record => :new_episodes
3
+ describe Verso::Extra, :vcr do
5
4
 
6
5
  before(:each) do
7
6
  @extra = Verso::CourseList.new(:code => "6320").last.extras.first
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_verso_list_examples'
3
3
 
4
- describe Verso::ExtrasList do
5
- use_vcr_cassette :record => :new_episodes
4
+ describe Verso::ExtrasList, :vcr do
6
5
 
7
6
  before(:each) do
8
7
  @list = Verso::ExtrasList.new(
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Verso::Frontmatter do
4
- use_vcr_cassette :record => :new_episodes
3
+ describe Verso::Frontmatter, :vcr do
5
4
 
6
5
  before(:each) do
7
6
  @fm = Verso::Frontmatter.new(:code => "6321",
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Verso::OccupationData do
4
- use_vcr_cassette :record => :new_episodes
3
+ describe Verso::OccupationData, :vcr do
5
4
 
6
5
  before(:each) do
7
6
  @od = Verso::OccupationList.new(:text => "golf").first
@@ -39,4 +38,34 @@ describe Verso::OccupationData do
39
38
  @od.occupations.first.should be_a(Verso::Occupation)
40
39
  end
41
40
  end
41
+
42
+ describe 'Verso::OccupationData.find_by_slugs' do
43
+ before do
44
+ @od = Verso::OccupationData.find_by_slugs(
45
+ 'agriculture-food-and-natural-resources',
46
+ 'agribusiness-systems',
47
+ 'agricultural-commodity-broker'
48
+ )
49
+ end
50
+
51
+ it 'is an OccupationData' do
52
+ @od.should be_a(Verso::OccupationData)
53
+ end
54
+
55
+ it 'has the correct Cluster' do
56
+ @od.cluster.title.should == 'Agriculture, Food and Natural Resources'
57
+ end
58
+
59
+ it 'has the correct Pathway' do
60
+ @od.pathway.title.should == 'Agribusiness Systems'
61
+ end
62
+
63
+ it 'has only one Occupation' do
64
+ @od.occupations.count.should == 1
65
+ end
66
+
67
+ it 'has the correct Occupation' do
68
+ @od.occupations.first.title.should == 'Agricultural Commodity Broker'
69
+ end
70
+ end
42
71
  end
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_verso_list_examples'
3
3
 
4
- describe Verso::OccupationList do
5
- use_vcr_cassette :record => :new_episodes
4
+ describe Verso::OccupationList, :vcr do
6
5
 
7
6
  before(:each) do
8
7
  @list = Verso::OccupationList.new(:text => "teacher")
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Verso::Occupation do
4
- use_vcr_cassette :record => :new_episodes
3
+ describe Verso::Occupation, :vcr do
5
4
 
6
5
  before(:each) do
7
6
  @occ = Verso::OccupationList.new(:text => "golf").first.occupations.first
@@ -82,4 +81,18 @@ describe Verso::Occupation do
82
81
  @occ.title.should be_a(String)
83
82
  end
84
83
  end
84
+
85
+ describe '#slug' do
86
+ it 'responds' do
87
+ @occ.should respond_to(:slug)
88
+ end
89
+
90
+ it 'is a string' do
91
+ @occ.slug.should be_a(String)
92
+ end
93
+
94
+ it 'looks like the title' do
95
+ @occ.slug.should == 'turf-farmer'
96
+ end
97
+ end
85
98
  end
data/spec/pathway_spec.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Verso::Pathway do
4
- use_vcr_cassette :record => :new_episodes
3
+ describe Verso::Pathway, :vcr do
5
4
 
6
5
  before do
7
6
  @pathway = Verso::ClusterList.new.first.pathways.first
@@ -45,6 +44,20 @@ describe Verso::Pathway do
45
44
  end
46
45
  end
47
46
 
47
+ describe '#slug' do
48
+ it 'responds' do
49
+ @pathway.should respond_to(:slug)
50
+ end
51
+
52
+ it 'is a string' do
53
+ @pathway.slug.should be_a(String)
54
+ end
55
+
56
+ it 'looks like the title' do
57
+ @pathway.slug.should == 'agribusiness-systems'
58
+ end
59
+ end
60
+
48
61
  describe '#occupations' do
49
62
  it 'responds' do
50
63
  @pathway.should respond_to(:occupations)
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_verso_list_examples'
3
3
 
4
- describe Verso::ProgramAreaList do
5
- use_vcr_cassette :record => :new_episodes
4
+ describe Verso::ProgramAreaList, :vcr do
6
5
 
7
6
  before do
8
7
  @list = Verso::ProgramAreaList.new
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Verso::ProgramArea do
4
- use_vcr_cassette :record => :new_episodes
3
+ describe Verso::ProgramArea, :vcr do
5
4
 
6
5
  before do
7
6
  @pa = Verso::ProgramArea.new("title" => "Career Connections")
data/spec/spec_helper.rb CHANGED
@@ -3,21 +3,14 @@ require 'verso'
3
3
  require 'vcr'
4
4
 
5
5
  VCR.configure do |c|
6
- c.hook_into :fakeweb
6
+ c.hook_into :webmock
7
7
  c.ignore_localhost = true
8
8
  c.cassette_library_dir = 'tmp/cassettes'
9
+ c.default_cassette_options = { :record => :new_episodes }
10
+ c.configure_rspec_metadata!
9
11
  end
10
12
 
11
13
  RSpec.configure do |config|
12
- # == Mock Framework
13
- #
14
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate
15
- # line:
16
- #
17
- # config.mock_with :mocha
18
- # config.mock_with :flexmock
19
- # config.mock_with :rr
14
+ config.treat_symbols_as_metadata_keys_with_true_values = true
20
15
  config.mock_with :rspec
21
-
22
- config.extend VCR::RSpec::Macros
23
16
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Verso::Standard do
4
- use_vcr_cassette :record => :new_episodes
3
+ describe Verso::Standard, :vcr do
5
4
 
6
5
  before do
7
6
  @standard = Verso::Standard.new(
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_verso_list_examples'
3
3
 
4
- describe Verso::StandardsList do
5
- use_vcr_cassette :record => :new_episodes
4
+ describe Verso::StandardsList, :vcr do
6
5
 
7
6
  before do
8
7
  @list = Verso::StandardsList.new(
@@ -69,5 +68,11 @@ describe Verso::StandardsList do
69
68
  list.code.should == @course.code
70
69
  list.edition.should == @course.edition
71
70
  end
71
+
72
+ it 'returns an empty list if the course has no standards' do
73
+ course = Verso::Course.new(:code => "1234", :edition => "1929",
74
+ :related_resources => [])
75
+ Verso::StandardsList.from_course(course).should be_empty
76
+ end
72
77
  end
73
78
  end
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_verso_list_examples'
3
3
 
4
- describe Verso::TaskList do
5
- use_vcr_cassette :record => :new_episodes
4
+ describe Verso::TaskList, :vcr do
6
5
 
7
6
  before do
8
7
  @list = Verso::TaskList.new(
data/spec/task_spec.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Verso::Task do
4
- use_vcr_cassette :record => :new_episodes
3
+ describe Verso::Task, :vcr do
5
4
 
6
5
  before(:each) do
7
6
  @task = Verso::CourseList.new(:code => "6320").
@@ -81,7 +80,7 @@ describe Verso::Task do
81
80
  @task.should respond_to(:id)
82
81
  end
83
82
 
84
- it 'is a Fixnum' do
83
+ it 'is a String' do
85
84
  @task.id.should be_a(String)
86
85
  end
87
86
 
data/verso.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
  s.add_runtime_dependency 'json'
21
21
  s.add_runtime_dependency 'addressable'
22
- s.add_development_dependency "fakeweb"
22
+ s.add_development_dependency "webmock"
23
23
  s.add_development_dependency "redcarpet"
24
24
  s.add_development_dependency "rspec"
25
25
  s.add_development_dependency "vcr"
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
4
+ version: 0.0.8
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-25 00:00:00.000000000 Z
12
+ date: 2013-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70332933737440 !ruby/object:Gem::Requirement
16
+ requirement: &70226498925940 !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: *70332933737440
24
+ version_requirements: *70226498925940
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: addressable
27
- requirement: &70332933737020 !ruby/object:Gem::Requirement
27
+ requirement: &70226498925180 !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: *70332933737020
35
+ version_requirements: *70226498925180
36
36
  - !ruby/object:Gem::Dependency
37
- name: fakeweb
38
- requirement: &70332933736600 !ruby/object:Gem::Requirement
37
+ name: webmock
38
+ requirement: &70226498924240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70332933736600
46
+ version_requirements: *70226498924240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: redcarpet
49
- requirement: &70332933736180 !ruby/object:Gem::Requirement
49
+ requirement: &70226498923280 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70332933736180
57
+ version_requirements: *70226498923280
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &70332933735760 !ruby/object:Gem::Requirement
60
+ requirement: &70226498922560 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70332933735760
68
+ version_requirements: *70226498922560
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: vcr
71
- requirement: &70332933735340 !ruby/object:Gem::Requirement
71
+ requirement: &70226498921060 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70332933735340
79
+ version_requirements: *70226498921060
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: yard
82
- requirement: &70332933734920 !ruby/object:Gem::Requirement
82
+ requirement: &70226498920560 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70332933734920
90
+ version_requirements: *70226498920560
91
91
  description: A Ruby wrapper for the Virginia CTE Resource Center's Web API
92
92
  email:
93
93
  - himself@leecapps.com
@@ -113,6 +113,7 @@ files:
113
113
  - lib/verso/edition_list.rb
114
114
  - lib/verso/emphasis.rb
115
115
  - lib/verso/emphasis_list.rb
116
+ - lib/verso/error.rb
116
117
  - lib/verso/examination_list.rb
117
118
  - lib/verso/extra.rb
118
119
  - lib/verso/extras_list.rb
@@ -125,6 +126,7 @@ files:
125
126
  - lib/verso/pathway.rb
126
127
  - lib/verso/program_area.rb
127
128
  - lib/verso/program_area_list.rb
129
+ - lib/verso/sluggable.rb
128
130
  - lib/verso/standard.rb
129
131
  - lib/verso/standards_list.rb
130
132
  - lib/verso/task.rb