aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-07-12 14:33:46 -0500
committerJoshua Peek <josh@joshpeek.com>2008-07-12 14:33:46 -0500
commit73b34e9f75d33dc0709d4ad36c912bdbb8977994 (patch)
treeeea7cb8c3cb428ecfacb6263f4e8f1d903a71824 /actionpack/lib/action_controller
parent30204c4e66cea989c4ee48b52c8827c79e98f14a (diff)
downloadrails-73b34e9f75d33dc0709d4ad36c912bdbb8977994.tar.gz
rails-73b34e9f75d33dc0709d4ad36c912bdbb8977994.tar.bz2
rails-73b34e9f75d33dc0709d4ad36c912bdbb8977994.zip
Refactor template preloading. New abstractions include Renderable mixins and a refactored Template class.
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/assertions/response_assertions.rb2
-rwxr-xr-xactionpack/lib/action_controller/base.rb9
-rw-r--r--actionpack/lib/action_controller/layout.rb2
-rw-r--r--actionpack/lib/action_controller/test_process.rb10
4 files changed, 9 insertions, 14 deletions
diff --git a/actionpack/lib/action_controller/assertions/response_assertions.rb b/actionpack/lib/action_controller/assertions/response_assertions.rb
index 64aaf6211f..cb36405700 100644
--- a/actionpack/lib/action_controller/assertions/response_assertions.rb
+++ b/actionpack/lib/action_controller/assertions/response_assertions.rb
@@ -93,7 +93,7 @@ module ActionController
if expected.nil?
!@response.rendered_with_file?
else
- expected == rendered
+ rendered.match(expected)
end
end
end
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 9d9ff527c2..6926941396 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -431,7 +431,7 @@ module ActionController #:nodoc:
end
def view_paths=(value)
- @view_paths = ActionView::ViewLoadPaths.new(Array(value)) if value
+ @view_paths = ActionView::PathSet.new(Array(value)) if value
end
# Adds a view_path to the front of the view_paths array.
@@ -652,7 +652,7 @@ module ActionController #:nodoc:
end
def view_paths=(value)
- @template.view_paths = ViewLoadPaths.new(value)
+ @template.view_paths = PathSet.new(value)
end
# Adds a view_path to the front of the view_paths array.
@@ -1248,9 +1248,8 @@ module ActionController #:nodoc:
end
def template_exempt_from_layout?(template_name = default_template_name)
- extension = @template && @template.pick_template_extension(template_name)
- name_with_extension = !template_name.include?('.') && extension ? "#{template_name}.#{extension}" : template_name
- @@exempt_from_layout.any? { |ext| name_with_extension =~ ext }
+ template_name = @template.pick_template(template_name).to_s if @template
+ @@exempt_from_layout.any? { |ext| template_name =~ ext }
end
def default_template_name(action_name = self.action_name)
diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb
index d0c717ff67..8b6febe254 100644
--- a/actionpack/lib/action_controller/layout.rb
+++ b/actionpack/lib/action_controller/layout.rb
@@ -304,7 +304,7 @@ module ActionController #:nodoc:
end
def layout_directory?(layout_name)
- @template.view_paths.find_template_file_for_path("#{File.join('layouts', layout_name)}.#{@template.template_format}.erb") ? true : false
+ @template.file_exists?("#{File.join('layouts', layout_name)}.#{@template.template_format}")
end
end
end
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb
index 8ae73a66f4..52884a93f4 100644
--- a/actionpack/lib/action_controller/test_process.rb
+++ b/actionpack/lib/action_controller/test_process.rb
@@ -207,13 +207,9 @@ module ActionController #:nodoc:
# Returns the template path of the file which was used to
# render this response (or nil)
- def rendered_file(with_controller=false)
- unless template.first_render.nil?
- unless with_controller
- template.first_render
- else
- template.first_render.split('/').last || template.first_render
- end
+ def rendered_file(with_controller = false)
+ if template.first_render
+ template.first_render.to_s
end
end