Handle 1.8 VS 1.9 differences in fetch exception.
This commit is contained in:
@@ -23,7 +23,7 @@ class AboutHashes < EdgeCase::Koan
|
||||
def test_accessing_hashes_with_fetch
|
||||
hash = { :one => "uno" }
|
||||
assert_equal "uno", hash.fetch(:one)
|
||||
assert_raise(___(IndexError)) do
|
||||
assert_raise(___(IndexError, KeyError)) do
|
||||
hash.fetch(:doesnt_exist)
|
||||
end
|
||||
|
||||
|
||||
@@ -44,8 +44,12 @@ def _n_(value=999999, value19=:mu)
|
||||
end
|
||||
|
||||
# Error object replacement value.
|
||||
def ___(value=FillMeInError)
|
||||
value
|
||||
def ___(value=FillMeInError, value19=:mu)
|
||||
if RUBY_VERSION < "1.9"
|
||||
value
|
||||
else
|
||||
(value19 == :mu) ? value : value19
|
||||
end
|
||||
end
|
||||
|
||||
# Method name replacement.
|
||||
|
||||
Reference in New Issue
Block a user