diff options
author | Carl Lerche <carllerche@mac.com> | 2009-03-20 18:38:03 -0700 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-03-23 10:23:14 -0700 |
commit | ab17ecfe5d97d5026d67688ddefe11a458701076 (patch) | |
tree | 1aa5e9ba238e0b9a2cc9e7bfc19a750ebc5ebd0b /actionpack/test/new_base/fixture_view_path_test.rb | |
parent | c6123c37030b715d088860ea1ca79060659b0e3c (diff) | |
download | rails-ab17ecfe5d97d5026d67688ddefe11a458701076.tar.gz rails-ab17ecfe5d97d5026d67688ddefe11a458701076.tar.bz2 rails-ab17ecfe5d97d5026d67688ddefe11a458701076.zip |
Finished implementing :layout for most of the render options
Diffstat (limited to 'actionpack/test/new_base/fixture_view_path_test.rb')
-rw-r--r-- | actionpack/test/new_base/fixture_view_path_test.rb | 64 |
1 files changed, 15 insertions, 49 deletions
diff --git a/actionpack/test/new_base/fixture_view_path_test.rb b/actionpack/test/new_base/fixture_view_path_test.rb index e350de9d45..7792a14a20 100644 --- a/actionpack/test/new_base/fixture_view_path_test.rb +++ b/actionpack/test/new_base/fixture_view_path_test.rb @@ -1,53 +1,15 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper") -module ActionView #:nodoc: - class FixtureTemplate < Template - class FixturePath < Template::Path - def initialize(hash) - @hash = {} - - hash.each do |k, v| - @hash[k.sub(/\.\w+$/, '')] = FixtureTemplate.new(v, k.split("/").last, self) - end - - super("") - end - - def find_template(path) - @hash[path] - end - end - - def initialize(body, *args) - @body = body - super(*args) - end - - def source - @body - end - - private - - def find_full_path(path, load_paths) - return '/', path - end - - end -end - -OMG = { - "happy_path/render_action/hello_world.html.erb" => "Hello world!", - "happy_path/render_action/goodbye_world.html.erb" => "Goodbye world!", - "happy_path/sexy_time/borat.html.erb" => "I LIKE!!!" -} - module HappyPath # This has no layout and it works - class RenderActionController < ActionController::Base2 + class RenderActionLolController < ActionController::Base2 - self.view_paths = [ActionView::FixtureTemplate::FixturePath.new(OMG)] + self.view_paths = [ActionView::FixtureTemplate::FixturePath.new({ + "happy_path/render_action_lol/hello_world.html.erb" => "Hello world!", + "happy_path/render_action_lol/goodbye_world.html.erb" => "Goodbye world!", + "happy_path/sexy_time/borat.html.erb" => "I LIKE!!!" + })] def render_action_hello_world render :action => "hello_world" @@ -60,7 +22,11 @@ module HappyPath end class SexyTimeController < ActionController::Base2 - self.view_paths = [ActionView::FixtureTemplate::FixturePath.new(OMG)] + self.view_paths = [ActionView::FixtureTemplate::FixturePath.new({ + "happy_path/render_action_lol/hello_world.html.erb" => "Hello world!", + "happy_path/render_action_lol/goodbye_world.html.erb" => "Goodbye world!", + "happy_path/sexy_time/borat.html.erb" => "I LIKE!!!" + })] def borat render "borat" @@ -68,19 +34,19 @@ module HappyPath end class TestRenderHelloAction < SimpleRouteCase - + describe "Rendering an action using :action => <String>" - + get "/happy_path/render_action/render_action_hello_world" assert_body "Hello world!" assert_status 200 - + end class TestRenderGoodbyeAction < SimpleRouteCase describe "Goodbye" - get "/happy_path/render_action/render_action_goodbye_world" + get "/happy_path/render_action_lol/render_action_goodbye_world" assert_body "Goodbye world!" assert_status 200 end |