Skip to content

Commit

Permalink
Fix up template handler tests. Closes #10437.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8372 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Dec 10, 2007
1 parent fade31a commit 93ec552
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 5 additions & 1 deletion actionpack/lib/action_view/base.rb
Expand Up @@ -252,6 +252,10 @@ def self.handler_for_extension(extension)
@@template_handlers[extension.to_sym] || @@default_template_handlers @@template_handlers[extension.to_sym] || @@default_template_handlers
end end


def self.template_handler_extensions
@@template_handler_extensions ||= @@template_handlers.keys.map(&:to_s).sort
end

register_default_template_handler :erb, TemplateHandlers::ERB register_default_template_handler :erb, TemplateHandlers::ERB
register_template_handler :rjs, TemplateHandlers::RJS register_template_handler :rjs, TemplateHandlers::RJS
register_template_handler :builder, TemplateHandlers::Builder register_template_handler :builder, TemplateHandlers::Builder
Expand Down Expand Up @@ -500,7 +504,7 @@ def find_template_extension_for(template_path)
def find_template_extension_from_handler(template_path, formatted = nil) def find_template_extension_from_handler(template_path, formatted = nil)
checked_template_path = formatted ? "#{template_path}.#{template_format}" : template_path checked_template_path = formatted ? "#{template_path}.#{template_format}" : template_path


@@template_handlers.each do |extension,| self.class.template_handler_extensions.each do |extension|
if template_exists?(checked_template_path, extension) if template_exists?(checked_template_path, extension)
return formatted ? "#{template_format}.#{extension}" : extension.to_s return formatted ? "#{template_format}.#{extension}" : extension.to_s
end end
Expand Down
4 changes: 2 additions & 2 deletions actionpack/test/controller/new_render_test.rb
Expand Up @@ -241,11 +241,11 @@ def @template.name() nil end
end end


def hello_world_from_rxml_using_action def hello_world_from_rxml_using_action
render :action => "hello_world.builder" render :action => "hello_world_from_rxml.builder"
end end


def hello_world_from_rxml_using_template def hello_world_from_rxml_using_template
render :template => "test/hello_world.builder" render :template => "test/hello_world_from_rxml.builder"
end end


def head_with_location_header def head_with_location_header
Expand Down
4 changes: 0 additions & 4 deletions actionpack/test/fixtures/test/hello_world.builder

This file was deleted.

0 comments on commit 93ec552

Please sign in to comment.