In one of my Rails test case:
test "something" do
assert_raise RuntimeError do
@foo.bar
end
end
I set up the @foo
标 题 (例如,测试案例将失败)
但以下法典通过了检验:
test "something" do
blah(@foo)
end
private
def blah(foo)
assert RuntimeError do
foo.bar
end
end
为什么如此?