verso 0.0.3 → 0.0.4

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.
@@ -1,91 +1,19 @@
1
1
  require 'spec_helper'
2
+ require 'shared_verso_list_examples'
2
3
 
3
4
  describe Verso::ExaminationList do
4
5
  use_vcr_cassette :record => :new_episodes
5
6
 
6
7
  before(:each) do
7
- @exams = Verso::ExaminationList.new
8
+ @list = Verso::ExaminationList.new
9
+ @kontained = OpenStruct
8
10
  end
9
11
 
10
- describe 'array-like behavior' do
11
- describe '#[]' do
12
- it 'responds' do
13
- @exams.should respond_to(:[])
14
- end
15
-
16
- it 'gets a OpenStruct object' do
17
- @exams[3].should be_a(OpenStruct)
18
- end
19
- end
20
-
21
- describe '#each' do
22
- it 'responds' do
23
- @exams.should respond_to(:each)
24
- end
25
-
26
- it 'yields' do
27
- expect { |b| @exams.each("foo", &b).to yield_control }
28
- end
29
-
30
- it 'yields OpenStruct objects' do
31
- @exams.each { |c| c.should be_a(OpenStruct) }
32
- end
33
- end
34
-
35
- describe '#empty?' do
36
- it 'responds' do
37
- @exams.should respond_to(:empty?)
38
- end
39
-
40
- it 'is not empty' do
41
- @exams.should_not be_empty
42
- end
43
- end
44
-
45
- describe '#last' do
46
- it 'responds' do
47
- @exams.should respond_to(:last)
48
- end
49
-
50
- it 'is a OpenStruct object' do
51
- @exams.last.should be_a(OpenStruct)
52
- end
53
- end
54
-
55
- describe '#length' do
56
- it 'responds' do
57
- @exams.should respond_to(:length)
58
- end
59
-
60
- it 'is a Fixnum' do
61
- @exams.length.should be_a(Fixnum)
62
- end
63
- end
64
-
65
- describe '#first' do
66
- it 'responds' do
67
- @exams.should respond_to(:first)
68
- end
69
-
70
- it 'is a OpenStruct object' do
71
- @exams.first.should be_a(OpenStruct)
72
- end
73
- end
74
-
75
- describe '#count' do
76
- it 'responds' do
77
- @exams.should respond_to(:count)
78
- end
79
-
80
- it 'is a Fixnum' do
81
- @exams.count.should be_a(Fixnum)
82
- end
83
- end
84
- end
12
+ it_behaves_like 'any Verso list'
85
13
 
86
14
  describe 'OpenStruct Examination stand-in' do
87
15
  before(:each) do
88
- @exam = Verso::ExaminationList.new.first
16
+ @exam = @list.first
89
17
  end
90
18
 
91
19
  describe '#amt_seal' do
@@ -1,88 +1,16 @@
1
1
  require 'spec_helper'
2
+ require 'shared_verso_list_examples'
2
3
 
3
4
  describe Verso::ExtrasList do
4
5
  use_vcr_cassette :record => :new_episodes
5
6
 
6
7
  before(:each) do
7
- @extras = Verso::ExtrasList.new(
8
+ @list = Verso::ExtrasList.new(
8
9
  :code => "6320",
9
10
  :edition => Verso::EditionList.new.last.year
10
11
  )
12
+ @kontained = Verso::Extra
11
13
  end
12
14
 
13
- describe 'array-like behavior' do
14
- describe '#[]' do
15
- it 'responds' do
16
- @extras.should respond_to(:[])
17
- end
18
-
19
- it 'gets a Verso::Extra object' do
20
- @extras[1].should be_a(Verso::Extra)
21
- end
22
- end
23
-
24
- describe '#each' do
25
- it 'responds' do
26
- @extras.should respond_to(:each)
27
- end
28
-
29
- it 'yields' do
30
- expect { |b| @extras.each("foo", &b).to yield_control }
31
- end
32
-
33
- it 'yields Verso::Extra objects' do
34
- @extras.each { |c| c.should be_a(Verso::Extra) }
35
- end
36
- end
37
-
38
- describe '#empty?' do
39
- it 'responds' do
40
- @extras.should respond_to(:empty?)
41
- end
42
-
43
- it 'is not empty' do
44
- @extras.should_not be_empty
45
- end
46
- end
47
-
48
- describe '#last' do
49
- it 'responds' do
50
- @extras.should respond_to(:last)
51
- end
52
-
53
- it 'is a Verso::Extra object' do
54
- @extras.last.should be_a(Verso::Extra)
55
- end
56
- end
57
-
58
- describe '#length' do
59
- it 'responds' do
60
- @extras.should respond_to(:length)
61
- end
62
-
63
- it 'is a Fixnum' do
64
- @extras.length.should be_a(Fixnum)
65
- end
66
- end
67
-
68
- describe '#first' do
69
- it 'responds' do
70
- @extras.should respond_to(:first)
71
- end
72
-
73
- it 'is a Verso::Extra object' do
74
- @extras.first.should be_a(Verso::Extra)
75
- end
76
- end
77
-
78
- describe '#count' do
79
- it 'responds' do
80
- @extras.should respond_to(:count)
81
- end
82
-
83
- it 'is a Fixnum' do
84
- @extras.count.should be_a(Fixnum)
85
- end
86
- end
87
- end
15
+ it_behaves_like "any Verso list"
88
16
  end
@@ -1,88 +1,16 @@
1
1
  require 'spec_helper'
2
+ require 'shared_verso_list_examples'
2
3
 
3
4
  describe Verso::OccupationList do
4
5
  use_vcr_cassette :record => :new_episodes
5
6
 
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
7
+ before(:each) do
8
+ @list = Verso::OccupationList.new(:text => "teacher")
9
+ @kontained = Verso::OccupationData
84
10
  end
85
11
 
12
+ it_behaves_like 'any Verso list'
13
+
86
14
  it 'returns an empty array if the search is empty' do
87
15
  Verso::OccupationList.new.should be_empty
88
16
  end
@@ -1,85 +1,13 @@
1
1
  require 'spec_helper'
2
+ require 'shared_verso_list_examples'
2
3
 
3
4
  describe Verso::ProgramAreaList do
4
5
  use_vcr_cassette :record => :new_episodes
5
6
 
6
7
  before do
7
8
  @list = Verso::ProgramAreaList.new
9
+ @kontained = Verso::ProgramArea
8
10
  end
9
11
 
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
84
- end
12
+ it_behaves_like 'any Verso list'
85
13
  end
@@ -0,0 +1,77 @@
1
+ shared_examples_for "any Verso list" do
2
+ describe '#[]' do
3
+ it 'responds' do
4
+ @list.should respond_to(:[])
5
+ end
6
+
7
+ it "is the right object" do
8
+ @list[-1].should be_a(@kontained)
9
+ end
10
+ end
11
+
12
+ describe '#each' do
13
+ it 'responds' do
14
+ @list.should respond_to(:each)
15
+ end
16
+
17
+ it 'yields' do
18
+ expect { |b| @list.each("foo", &b).to yield_control }
19
+ end
20
+
21
+ it "yields the right objects" do
22
+ @list.each do |c|
23
+ c.should be_a(@kontained)
24
+ end
25
+ end
26
+ end
27
+
28
+ describe '#empty?' do
29
+ it 'responds' do
30
+ @list.should respond_to(:empty?)
31
+ end
32
+
33
+ it 'is not empty' do
34
+ @list.should_not be_empty
35
+ end
36
+ end
37
+
38
+ describe '#last' do
39
+ it 'responds' do
40
+ @list.should respond_to(:last)
41
+ end
42
+
43
+ it "is a the right object" do
44
+ @list.last.should be_a(@kontained)
45
+ end
46
+ end
47
+
48
+ describe '#length' do
49
+ it 'responds' do
50
+ @list.should respond_to(:length)
51
+ end
52
+
53
+ it 'is a Fixnum' do
54
+ @list.length.should be_a(Fixnum)
55
+ end
56
+ end
57
+
58
+ describe '#first' do
59
+ it 'responds' do
60
+ @list.should respond_to(:first)
61
+ end
62
+
63
+ it "is a the right object" do
64
+ @list.first.should be_a(@kontained)
65
+ end
66
+ end
67
+
68
+ describe '#count' do
69
+ it 'responds' do
70
+ @list.should respond_to(:count)
71
+ end
72
+
73
+ it 'is a Fixnum' do
74
+ @list.count.should be_a(Fixnum)
75
+ end
76
+ end
77
+ end
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require 'shared_verso_list_examples'
2
3
 
3
4
  describe Verso::StandardsList do
4
5
  use_vcr_cassette :record => :new_episodes
@@ -8,83 +9,10 @@ describe Verso::StandardsList do
8
9
  :code => "6320",
9
10
  :edition => Verso::EditionList.new.last.year
10
11
  )
12
+ @kontained = Verso::Standard
11
13
  end
12
14
 
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
87
- end
15
+ it_behaves_like 'any Verso list'
88
16
 
89
17
  describe '#non_sols' do
90
18
  it 'responds' do
@@ -1,41 +1,46 @@
1
1
  require 'spec_helper'
2
+ require 'shared_verso_list_examples'
2
3
 
3
4
  describe Verso::TaskList do
4
5
  use_vcr_cassette :record => :new_episodes
5
6
 
6
7
  before do
7
- @tl = Verso::TaskList.new(
8
+ @list = Verso::TaskList.new(
8
9
  :code => "6320",
9
- :edition => Verso::EditionList.new.last.year)
10
+ :edition => Verso::EditionList.new.last.year
11
+ )
12
+ @kontained = Verso::DutyArea
10
13
  end
11
14
 
15
+ it_behaves_like 'any Verso list'
16
+
12
17
  describe '#code' do
13
18
  it 'responds' do
14
- @tl.should respond_to(:code)
19
+ @list.should respond_to(:code)
15
20
  end
16
21
 
17
22
  it 'is a String' do
18
- @tl.code.should be_a(String)
23
+ @list.code.should be_a(String)
19
24
  end
20
25
  end
21
26
 
22
27
  describe '#edition' do
23
28
  it 'responds' do
24
- @tl.should respond_to(:edition)
29
+ @list.should respond_to(:edition)
25
30
  end
26
31
 
27
32
  it 'is a String' do
28
- @tl.edition.should be_a(String)
33
+ @list.edition.should be_a(String)
29
34
  end
30
35
  end
31
36
 
32
37
  describe '#has_optional_task?' do
33
38
  it 'responds' do
34
- @tl.should respond_to(:has_optional_task?)
39
+ @list.should respond_to(:has_optional_task?)
35
40
  end
36
41
 
37
42
  it 'is Boolean' do
38
- @tl.has_optional_task?.to_s.should match(/true|false/)
43
+ @list.has_optional_task?.to_s.should match(/true|false/)
39
44
  end
40
45
 
41
46
  it 'is true if a task is non-essential' do
@@ -71,15 +76,15 @@ describe Verso::TaskList do
71
76
 
72
77
  describe '#has_sensitive_task?' do
73
78
  it 'responds' do
74
- @tl.should respond_to(:has_sensitive_task?)
79
+ @list.should respond_to(:has_sensitive_task?)
75
80
  end
76
81
 
77
82
  it 'is Boolean' do
78
- @tl.has_sensitive_task?.to_s.should match(/true|false/)
83
+ @list.has_sensitive_task?.to_s.should match(/true|false/)
79
84
  end
80
85
 
81
86
  it 'is false if no task is sensitive' do
82
- @tl.has_sensitive_task?.should be_false
87
+ @list.has_sensitive_task?.should be_false
83
88
  end
84
89
 
85
90
  it 'is true if a task is sensitive' do
@@ -97,83 +102,6 @@ describe Verso::TaskList do
97
102
  tl.has_sensitive_task?.should be_true
98
103
  end
99
104
  end
100
-
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
175
- end
176
-
177
105
  it "is empty if no task list is published" do
178
106
  tl = Verso::TaskList.new(:code => "1234", :edition => "1929")
179
107
  tl.should be_empty