Skip to content

Commit 5c6ae47

Browse files
committed
Merge pull request #2 from pechase/master
fixed minor bugs
2 parents ec2361b + a0ad938 commit 5c6ae47

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

lib/oai/provider/response.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ def valid?
6161

6262
return true if self.class.valid_options.nil? and options.empty?
6363

64+
# Added by [email protected]. Needed if the request includes an argument and there are no valid arguments for that verb (Identify, for example).
65+
raise OAI::ArgumentException.new if self.class.valid_options.nil? && !options.empty?
66+
6467
if self.class.required_options
6568
return false unless (self.class.required_options - @options.keys).empty?
6669
end

lib/oai/provider/resumption_token.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ def self.parse(token_string)
3232
end
3333
self.new(options)
3434
rescue => err
35-
raise ResumptionTokenException.new
35+
36+
# This was not caught by the tests.
37+
raise OAI::ResumptionTokenException.new
3638
end
3739
end
3840

test/provider/models.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ def generate_chunks(records, limit)
112112
end
113113

114114
def generate_records(number, timestamp = Time.now.utc.xmlschema, sets = [], deleted = false)
115-
@earliest = timestamp.dup if @earliest.nil? || timestamp.to_s < @earliest
115+
# [email protected] -- causes tests to die
116+
# @earliest = timestamp.dup if @earliest.nil? || timestamp.to_s < @earliest
117+
@earliest = timestamp.dup if @earliest.nil?
116118

117119
# Add any sets we don't already have
118120
sets = [sets] unless sets.respond_to?(:each)

test/provider/tc_exceptions.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ def setup
77
@provider = ComplexProvider.new
88
end
99

10+
11+
def test_argument_exception
12+
assert_raise(OAI::ArgumentException) do
13+
@provider.identify(:identifier => 'invalid_arg')
14+
end
15+
end
16+
1017
def test_resumption_token_exception
1118
assert_raise(OAI::ResumptionTokenException) do
1219
@provider.list_records(:resumption_token => 'aaadddd:1000')

test/provider/tc_simple_provider.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ def test_identify
1313
doc.elements["/OAI-PMH/Identify/repositoryName"].text
1414
assert_equal SimpleModel.new.earliest.to_s,
1515
doc.elements["/OAI-PMH/Identify/earliestDatestamp"].text
16+
17+
# PC
18+
# lambda { REXML::Document.new(@simple_provider.identify(:set => 'A')) }
19+
20+
1621
end
1722

1823
def test_list_sets

0 commit comments

Comments
 (0)