0
私はthis websiteからダウンロードしたコードを使ってルビーを学ぼうとしています。ここでex.classはどのように等しくなければならないのですか?
この時点で私は立ち往生しました。
def test_you_dont_get_null_pointer_errors_when_calling_methods_on_nil
# What happens when you call a method that doesn't exist. The
# following begin/rescue/end code block captures the exception and
# makes some assertions about it.
begin
nil.some_method_nil_doesnt_know_about
rescue Exception => ex
# What exception has been caught?
assert_equal NoMethodError, ex.class
# What message was attached to the exception?
# (HINT: replace __ with part of the error message.)
assert_match(/__/, ex.message)
end
エンド
Iは、エラーメッセージの一部と__を交換することになってんだけど、私は成功していません。さて、私は、エラーメッセージに単語間にスペースがあったと思ったので、いくつか試行した後、スペースで置き換えたので、私はそうでした。しかし、どのようにエラーメッセージが表示されるのですか?
は、右のあなたの例では、私のコンソールでNoMethodErrorで動作ありません。あなたはエラーメッセージを投稿できますか? – alony
私は質問を投稿したときに間違いを犯したと思いますので、私はそれを更新しました。 –