test/helpers.rb in chain-reactor-0.2.0 vs test/helpers.rb in chain-reactor-0.2.1
- old
+ new
@@ -12,10 +12,16 @@
end
def fatal
end
end
+ # KeyError doesn't exist in ruby 1.8
+ if !defined? ::KeyError
+ class ::KeyError < ::IndexError
+ end
+ end
+
class Params
def initialize(hash_data)
@hash = hash_data
end
@@ -24,10 +30,10 @@
end
def fetch(key,&block)
begin
@hash.fetch(key,&block)
- rescue KeyError => e
+ rescue ::KeyError,::IndexError => e
raise ::Main::Parameter::NoneSuch, key
end
end
end