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

ensure normalize_name is operating on a string

This commit is contained in:
Keeran Raj Hawoldar 2021-05-12 18:06:04 +01:00
parent 8b5ebb4132
commit 63c32e9eda
2 changed files with 5 additions and 0 deletions

View file

@ -194,6 +194,7 @@ module ActionView
# Fix when prefix is specified as part of the template name # Fix when prefix is specified as part of the template name
def normalize_name(name, prefixes) def normalize_name(name, prefixes)
name = name.to_s
idx = name.rindex("/") idx = name.rindex("/")
return name, prefixes.presence || [""] unless idx return name, prefixes.presence || [""] unless idx

View file

@ -149,6 +149,10 @@ module RenderTestCases
assert_equal "4", @view.render(inline: "(2**2).to_s", type: :ruby) assert_equal "4", @view.render(inline: "(2**2).to_s", type: :ruby)
end end
def test_render_template_via_symbol_lookup
assert_equal "Hello from Ruby code", @view.render(template: :ruby_template)
end
def test_render_template_with_localization_on_context_level def test_render_template_with_localization_on_context_level
old_locale, @view.locale = @view.locale, :da old_locale, @view.locale = @view.locale, :da
assert_equal "Hey verden", @view.render(template: "test/hello_world") assert_equal "Hey verden", @view.render(template: "test/hello_world")