2012-08-23 1 views
0

RubyKoans.com에서 일하고 있으며이 koan으로 about_symbols.rb에 갇혀 있습니다. 내가 assert_raise() 후 괄호 안에 뭔가를 넣어하기로되어있어 생각하지만 난 아무 생각이 없다 : 루비 : 코란에 붙이기

테스트입니다

The answers you seek... 
    [FillMeInError] exception expected, not Class: <NoMethodError> Message: <"undefined method `+' for :cats:Symbol"> ---Backtrace--- /Users/mm/Sites/koans/about_symbols.rb:89:in `block in test_symbols_cannot_be_concatenated' --------------- 

답변

3
:이 터미널에서 힌트가

def test_symbols_cannot_be_concatenated 
    # Exceptions will be pondered further father down the path 
    assert_raise(___) do 
     :cats + :dogs 
    end 
    end 

이것은 답변입니다. 대괄호 안에 오류를 넣어야합니다.

def test_symbols_cannot_be_concatenated 
    # Exceptions will be pondered further father down the path 
    assert_raise(NoMethodError) do 
     :cats + :dogs 
    end 
    end 
4

koan에 걸렸을 때 irb로 시도해보십시오. 그것은 당신이 무엇을 채울지를 알 수 있도록 도와 줄 수 있습니다.

$ irb 
>> :symbol + :another_symbol 
NoMethodError: undefined method `+' for :symbol:Symbol 
from (irb):2