1
0
Fork 0
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:
Jeremy Kemper 2008-07-07 11:57:53 -07:00
parent 350faf14e8
commit 4354aa36fb
3 changed files with 7 additions and 1 deletions

View file

@ -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

View file

@ -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"

View file

@ -0,0 +1 @@
Hello world!