rubyuw 0.99.4 → 0.99.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rubyuw/curriculum.rb +4 -4
- data/lib/rubyuw/curriculum_enrollment.rb +1 -1
- data/lib/rubyuw/errors.rb +4 -2
- data/lib/rubyuw/sln.rb +3 -3
- data/rubyuw.gemspec +3 -1
- data/test/mocked/errors_test.rb +23 -0
- metadata +3 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.99.
|
1
|
+
0.99.5
|
data/lib/rubyuw/curriculum.rb
CHANGED
@@ -160,13 +160,13 @@ module RubyUW
|
|
160
160
|
|
161
161
|
module Errors
|
162
162
|
# An error indicating that a quarter does not exist in the time schedule
|
163
|
-
class QuarterDoesNotExistError <
|
163
|
+
class QuarterDoesNotExistError < Error; end
|
164
164
|
|
165
165
|
# An error indicating that the curriculum requested does not exist
|
166
|
-
class CurriculumDoesNotExistError <
|
166
|
+
class CurriculumDoesNotExistError < Error; end
|
167
167
|
|
168
168
|
# An error indicating that the course listing didn't match the format
|
169
|
-
class CourseListingMatchError <
|
169
|
+
class CourseListingMatchError < Error
|
170
170
|
attr_reader :listing_text
|
171
171
|
|
172
172
|
def initialize(listing_text, message = nil)
|
@@ -178,7 +178,7 @@ module RubyUW
|
|
178
178
|
end
|
179
179
|
|
180
180
|
# An error indicating that a course does not exist
|
181
|
-
class CourseDoesNotExistError <
|
181
|
+
class CourseDoesNotExistError < Error
|
182
182
|
attr_reader :curriculum
|
183
183
|
attr_reader :course
|
184
184
|
attr_reader :original
|
data/lib/rubyuw/errors.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
module RubyUW
|
2
2
|
module Errors
|
3
|
+
class Error < Exception; end
|
4
|
+
|
3
5
|
# Exception signaling an invalid page was encountered.
|
4
|
-
class InvalidPageError <
|
6
|
+
class InvalidPageError < Error
|
5
7
|
attr_reader :page
|
6
8
|
|
7
9
|
def initialize(page, msg=nil)
|
@@ -11,6 +13,6 @@ module RubyUW
|
|
11
13
|
end
|
12
14
|
|
13
15
|
# Exception when login is required and not logged in.
|
14
|
-
class NotLoggedInError <
|
16
|
+
class NotLoggedInError < Error; end
|
15
17
|
end
|
16
18
|
end
|
data/lib/rubyuw/sln.rb
CHANGED
@@ -147,14 +147,14 @@ module RubyUW
|
|
147
147
|
# An error indicating that an SLN was requested back-to-back too
|
148
148
|
# quickly. MyUW enforces a timeout between requests for SLN information,
|
149
149
|
# and when this is not obeyed, this error will be thrown by RubyUW.
|
150
|
-
class SLNRequestedTooSoonError <
|
150
|
+
class SLNRequestedTooSoonError < Error; end
|
151
151
|
|
152
152
|
# An error indicating that an SLN requested is invalid (does not
|
153
153
|
# exist).
|
154
|
-
class SLNDoesNotExistError <
|
154
|
+
class SLNDoesNotExistError < Error; end
|
155
155
|
|
156
156
|
# An error indicating that the time scheduling service of MyUW
|
157
157
|
# is currently closed.
|
158
|
-
class SLNServiceClosedError <
|
158
|
+
class SLNServiceClosedError < Error; end
|
159
159
|
end
|
160
160
|
end
|
data/rubyuw.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rubyuw}
|
8
|
-
s.version = "0.99.
|
8
|
+
s.version = "0.99.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mitchell Hashimoto"]
|
@@ -37,6 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
"test/mocked/connection_test.rb",
|
38
38
|
"test/mocked/curriculum_enrollment_test.rb",
|
39
39
|
"test/mocked/curriculum_test.rb",
|
40
|
+
"test/mocked/errors_test.rb",
|
40
41
|
"test/mocked/fixture_pages/bad_request.html",
|
41
42
|
"test/mocked/fixture_pages/curric_courses.html",
|
42
43
|
"test/mocked/fixture_pages/curric_no_courses.html",
|
@@ -83,6 +84,7 @@ Gem::Specification.new do |s|
|
|
83
84
|
"test/mocked/connection_test.rb",
|
84
85
|
"test/mocked/curriculum_enrollment_test.rb",
|
85
86
|
"test/mocked/curriculum_test.rb",
|
87
|
+
"test/mocked/errors_test.rb",
|
86
88
|
"test/mocked/schedule_test.rb",
|
87
89
|
"test/mocked/sln_test.rb",
|
88
90
|
"test/mocked/test_helper.rb"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
+
|
3
|
+
class ErrorsTest < Test::Unit::TestCase
|
4
|
+
context "rubyuw exceptions" do
|
5
|
+
setup do
|
6
|
+
@exceptions = [RubyUW::Errors::InvalidPageError,
|
7
|
+
RubyUW::Errors::NotLoggedInError,
|
8
|
+
RubyUW::Errors::CourseDoesNotExistError,
|
9
|
+
RubyUW::Errors::CourseListingMatchError,
|
10
|
+
RubyUW::Errors::CurriculumDoesNotExistError,
|
11
|
+
RubyUW::Errors::QuarterDoesNotExistError,
|
12
|
+
RubyUW::Errors::SLNDoesNotExistError,
|
13
|
+
RubyUW::Errors::SLNRequestedTooSoonError,
|
14
|
+
RubyUW::Errors::SLNServiceClosedError]
|
15
|
+
end
|
16
|
+
|
17
|
+
should "all inherit from RubyUW::Errors::Error" do
|
18
|
+
@exceptions.each do |exception_clazz|
|
19
|
+
assert_equal RubyUW::Errors::Error, exception_clazz.superclass
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyuw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.99.
|
4
|
+
version: 0.99.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitchell Hashimoto
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- test/mocked/connection_test.rb
|
53
53
|
- test/mocked/curriculum_enrollment_test.rb
|
54
54
|
- test/mocked/curriculum_test.rb
|
55
|
+
- test/mocked/errors_test.rb
|
55
56
|
- test/mocked/fixture_pages/bad_request.html
|
56
57
|
- test/mocked/fixture_pages/curric_courses.html
|
57
58
|
- test/mocked/fixture_pages/curric_no_courses.html
|
@@ -120,6 +121,7 @@ test_files:
|
|
120
121
|
- test/mocked/connection_test.rb
|
121
122
|
- test/mocked/curriculum_enrollment_test.rb
|
122
123
|
- test/mocked/curriculum_test.rb
|
124
|
+
- test/mocked/errors_test.rb
|
123
125
|
- test/mocked/schedule_test.rb
|
124
126
|
- test/mocked/sln_test.rb
|
125
127
|
- test/mocked/test_helper.rb
|