提交 24a8ae4e 编写于 作者: M Michael Koziarski

Try to get more useful errors out of the test_line_offset failures

上级 3c282f3a
......@@ -101,12 +101,7 @@ def render_xml_with_custom_content_type
end
def render_line_offset
begin
render :inline => '<% raise %>', :locals => {:foo => 'bar'}
rescue RuntimeError => exc
end
line = exc.backtrace.first
render :text => line
render :inline => '<% raise %>', :locals => {:foo => 'bar'}
end
def heading
......@@ -238,10 +233,15 @@ def test_render
end
def test_line_offset
get :render_line_offset
line = @response.body
assert(line =~ %r{:(\d+):})
assert_equal "1", $1
begin
get :render_line_offset
flunk "the action should have raised an exception"
rescue RuntimeError => exc
line = exc.backtrace.first
assert(line =~ %r{:(\d+):})
assert_equal "1", $1,
"The line offset is wrong, perhaps the wrong exception has been raised, exception was: #{exc.inspect}"
end
end
def test_render_with_forward_slash
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册