I'm hacking my way through the EdgeCase RubyKoans (www.rubykoans.com) and am stuck on the method starting at line 35 in about_methods.rb here. Running rake fails predictably and tells me to look at line 36. I'm reasonable sure I have the assert_match correct ("0 for 2") but I don't know what's failing. It's very possible that the assert_raise(___) line should have something inbetween the parentheses, but I have no idea what that should be. Any hints or nudges? Thanks much.
edit: here's the short snippet of offending code:
def my_global_method(a,b)
a + b
end
-snip-
def test_calling_global_methods_with_wrong_number_of_arguments
exception = assert_raise(___) do
my_global_method
end
assert_match(/"0 for 2"/, exception.message)
exception = assert_raise(___) do
my_global_method(1,2,3)
end
assert_match(/__/, exception.message)
end
Try removing the quotes from the regex:
assert_match(/0 for 2/, exception.message)
exception = assert_raise(___) do
You're supposed to substitute the underscores with the error you expect to be raised. The error is an object - what kind of object? And what zetetic said, the regex is incorrect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With