1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #35788 from prathamesh-sonpatki/fix-annotate-typo

Fix annotated typo
This commit is contained in:
Kasper Timm Hansen 2019-03-29 16:35:49 +01:00 committed by GitHub
commit 839b8d42ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 9 deletions

View file

@ -305,7 +305,7 @@ module ActionController
logger.fatal do
message = +"\n#{exception.class} (#{exception.message}):\n"
message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)
message << exception.annotated_source_code.to_s if exception.respond_to?(:annotated_source_code)
message << " " << exception.backtrace.join("\n ")
"#{message}\n\n"
end

View file

@ -146,7 +146,7 @@ module ActionDispatch
message = []
message << " "
message << "#{exception.class} (#{exception.message}):"
message.concat(exception.annoted_source_code) if exception.respond_to?(:annoted_source_code)
message.concat(exception.annotated_source_code) if exception.respond_to?(:annotated_source_code)
message << " "
message.concat(trace)

View file

@ -34,7 +34,7 @@ module ActionView
return unless logger
message = +"\n#{exception.class} (#{exception.message}):\n"
message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)
message << exception.annotated_source_code.to_s if exception.respond_to?(:annotated_source_code)
message << " " << exception.backtrace.join("\n ")
logger.fatal("#{message}\n\n")
end

View file

@ -109,7 +109,7 @@ module ActionView
end
end
def annoted_source_code
def annotated_source_code
source_extract(4)
end
@ -151,7 +151,7 @@ module ActionView
MESSAGE
end
def annoted_source_code
def annotated_source_code
@offending_code_string.split("\n").map.with_index(1) { |line, index|
indentation = " " * 4
"#{index}:#{indentation}#{line}"

View file

@ -262,7 +262,7 @@ module RenderTestCases
def test_render_template_with_syntax_error
e = assert_raises(ActionView::Template::Error) { @view.render(template: "test/syntax_error") }
assert_match %r!syntax!, e.message
assert_equal "1: <%= foo(", e.annoted_source_code[0].strip
assert_equal "1: <%= foo(", e.annotated_source_code[0].strip
end
def test_render_partial_with_errors
@ -270,13 +270,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[0].strip
assert_equal "1: <%= doesnt_exist %>", e.annotated_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
error_lines = e.annotated_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
@ -296,7 +296,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[0].strip
assert_equal "1: <%= doesnt_exist %>", e.annotated_source_code[0].strip
assert_equal File.expand_path("#{FIXTURE_LOAD_PATH}/test/_raise.html.erb"), e.file_name
end