mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-15 07:23:19 -04:00
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
|
def test_accessing_hashes_with_fetch
|
||||||
hash = { :one => "uno" }
|
hash = { :one => "uno" }
|
||||||
assert_equal "uno", hash.fetch(:one)
|
assert_equal "uno", hash.fetch(:one)
|
||||||
assert_raise(___(IndexError)) do
|
assert_raise(___(IndexError, KeyError)) do
|
||||||
hash.fetch(:doesnt_exist)
|
hash.fetch(:doesnt_exist)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,12 @@ def _n_(value=999999, value19=:mu)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Error object replacement value.
|
# Error object replacement value.
|
||||||
def ___(value=FillMeInError)
|
def ___(value=FillMeInError, value19=:mu)
|
||||||
value
|
if RUBY_VERSION < "1.9"
|
||||||
|
value
|
||||||
|
else
|
||||||
|
(value19 == :mu) ? value : value19
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Method name replacement.
|
# Method name replacement.
|
||||||
|
|||||||
Reference in New Issue
Block a user