mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Rendering default template for missing actions works with non-word characters in action name
This commit is contained in:
parent
350faf14e8
commit
4354aa36fb
3 changed files with 7 additions and 1 deletions
|
@ -74,7 +74,7 @@ module ActionView #:nodoc:
|
|||
# Returns file split into an array
|
||||
# [base_path, name, format, extension]
|
||||
def split(file)
|
||||
if m = file.match(/^(.*\/)?(\w+)\.?(\w+)?\.?(\w+)?\.?(\w+)?$/)
|
||||
if m = file.match(/^(.*\/)?([^\.]+)\.?(\w+)?\.?(\w+)?\.?(\w+)?$/)
|
||||
if m[5] # Mulipart formats
|
||||
[m[1], m[2], "#{m[3]}.#{m[4]}", m[5]]
|
||||
elsif m[4] # Single format
|
||||
|
|
|
@ -489,6 +489,11 @@ class NewRenderTest < Test::Unit::TestCase
|
|||
assert_equal "<html>Hello world!</html>", @response.body
|
||||
end
|
||||
|
||||
def test_renders_default_template_for_missing_action
|
||||
get :'hyphen-ated'
|
||||
assert_template 'test/hyphen-ated'
|
||||
end
|
||||
|
||||
def test_do_with_render
|
||||
get :render_hello_world
|
||||
assert_template "test/hello_world"
|
||||
|
|
1
actionpack/test/fixtures/test/hyphen-ated.erb
vendored
Normal file
1
actionpack/test/fixtures/test/hyphen-ated.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
Hello world!
|
Loading…
Reference in a new issue