Browse files

Try to get more useful errors out of the test_line_offset failures

  • Loading branch information...
1 parent 3c282f3 commit 24a8ae4e08fcd15a8c3792990d1d0981d004d339 @NZKoz NZKoz committed Jul 15, 2008
Showing with 10 additions and 10 deletions.
  1. +10 −10 actionpack/test/controller/render_test.rb
View
20 actionpack/test/controller/render_test.rb
@@ -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

0 comments on commit 24a8ae4

Please sign in to comment.