diff options
author | Vipul A M <vipulnsward@gmail.com> | 2016-01-23 02:57:52 +0530 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2016-02-12 23:10:33 +0530 |
commit | 632938cfda8762a98a7c7a360a6f05c29d2cdb5e (patch) | |
tree | 055c53a1a97d28018b03d07373995c000bbc7ee1 /actionview | |
parent | f709682697dd1654e4251e7c3db30e054910cccb (diff) | |
download | rails-632938cfda8762a98a7c7a360a6f05c29d2cdb5e.tar.gz rails-632938cfda8762a98a7c7a360a6f05c29d2cdb5e.tar.bz2 rails-632938cfda8762a98a7c7a360a6f05c29d2cdb5e.zip |
WIP: Errors in logs should show log tags as well.
- Changed formatted_code_for to return array of logs to be tagged for each line
- Changed some render tests to match new behaviour of return
Fixes #22979
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/template/error.rb | 4 | ||||
-rw-r--r-- | actionview/test/template/render_test.rb | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/actionview/lib/action_view/template/error.rb b/actionview/lib/action_view/template/error.rb index ccee785d3e..3f38c3d2b9 100644 --- a/actionview/lib/action_view/template/error.rb +++ b/actionview/lib/action_view/template/error.rb @@ -135,13 +135,13 @@ module ActionView end def formatted_code_for(source_code, line_counter, indent, output) - start_value = (output == :html) ? {} : "" + start_value = (output == :html) ? {} : [] source_code.inject(start_value) do |result, line| line_counter += 1 if output == :html result.update(line_counter.to_s => "%#{indent}s %s\n" % ["", line]) else - result << "%#{indent}s: %s\n" % [line_counter, line] + result << "%#{indent}s: %s" % [line_counter, line] end end end diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 333e0cca11..bf811abdd0 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -226,13 +226,13 @@ module RenderTestCases assert_match %r!method.*doesnt_exist!, e.message assert_equal "", e.sub_template_message assert_equal "1", e.line_number - assert_equal "1: <%= doesnt_exist %>", e.annoted_source_code.strip + assert_equal "1: <%= doesnt_exist %>", e.annoted_source_code[0].strip assert_equal File.expand_path("#{FIXTURE_LOAD_PATH}/test/_raise.html.erb"), e.file_name end def test_render_error_indentation e = assert_raises(ActionView::Template::Error) { @view.render(:partial => "test/raise_indentation") } - error_lines = e.annoted_source_code.split("\n") + error_lines = e.annoted_source_code assert_match %r!error\shere!, e.message assert_equal "11", e.line_number assert_equal " 9: <p>Ninth paragraph</p>", error_lines.second @@ -252,7 +252,7 @@ module RenderTestCases assert_match %r!method.*doesnt_exist!, e.message assert_equal "", e.sub_template_message assert_equal "1", e.line_number - assert_equal "1: <%= doesnt_exist %>", e.annoted_source_code.strip + assert_equal "1: <%= doesnt_exist %>", e.annoted_source_code[0].strip assert_equal File.expand_path("#{FIXTURE_LOAD_PATH}/test/_raise.html.erb"), e.file_name end |