aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/new_base
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-06-23 18:13:46 -0300
committerEmilio Tagua <miloops@gmail.com>2009-06-23 18:13:46 -0300
commitb9088dce07f8525cdb84a1312a77b81db79067d6 (patch)
tree72ace069842b074981ba814ef1c335271176ce27 /actionpack/test/new_base
parent4864f92ee34e840307d968fa8b04972b6d786fe8 (diff)
parent4417a19b035d73eb46a5e06e296a4b1c8091bef1 (diff)
downloadrails-b9088dce07f8525cdb84a1312a77b81db79067d6.tar.gz
rails-b9088dce07f8525cdb84a1312a77b81db79067d6.tar.bz2
rails-b9088dce07f8525cdb84a1312a77b81db79067d6.zip
Merge commit 'rails/master'
Diffstat (limited to 'actionpack/test/new_base')
-rw-r--r--actionpack/test/new_base/content_type_test.rb2
-rw-r--r--actionpack/test/new_base/etag_test.rb2
-rw-r--r--actionpack/test/new_base/render_action_test.rb8
-rw-r--r--actionpack/test/new_base/render_implicit_action_test.rb2
-rw-r--r--actionpack/test/new_base/render_layout_test.rb6
-rw-r--r--actionpack/test/new_base/render_partial_test.rb2
-rw-r--r--actionpack/test/new_base/render_rjs_test.rb46
-rw-r--r--actionpack/test/new_base/render_template_test.rb6
-rw-r--r--actionpack/test/new_base/render_test.rb2
-rw-r--r--actionpack/test/new_base/render_text_test.rb4
-rw-r--r--actionpack/test/new_base/render_xml_test.rb2
11 files changed, 64 insertions, 18 deletions
diff --git a/actionpack/test/new_base/content_type_test.rb b/actionpack/test/new_base/content_type_test.rb
index 82b817a5a3..cfc03a3024 100644
--- a/actionpack/test/new_base/content_type_test.rb
+++ b/actionpack/test/new_base/content_type_test.rb
@@ -19,7 +19,7 @@ module ContentType
class ImpliedController < ActionController::Base
# Template's mime type is used if no content_type is specified
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"content_type/implied/i_am_html_erb.html.erb" => "Hello world!",
"content_type/implied/i_am_xml_erb.xml.erb" => "<xml>Hello world!</xml>",
"content_type/implied/i_am_html_builder.html.builder" => "xml.p 'Hello'",
diff --git a/actionpack/test/new_base/etag_test.rb b/actionpack/test/new_base/etag_test.rb
index a40d3c936a..3a69e7dac4 100644
--- a/actionpack/test/new_base/etag_test.rb
+++ b/actionpack/test/new_base/etag_test.rb
@@ -2,7 +2,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
module Etags
class BasicController < ActionController::Base
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"etags/basic/base.html.erb" => "Hello from without_layout.html.erb",
"layouts/etags.html.erb" => "teh <%= yield %> tagz"
)]
diff --git a/actionpack/test/new_base/render_action_test.rb b/actionpack/test/new_base/render_action_test.rb
index 4402eadf42..dfa7cc2141 100644
--- a/actionpack/test/new_base/render_action_test.rb
+++ b/actionpack/test/new_base/render_action_test.rb
@@ -3,7 +3,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
module RenderAction
# This has no layout and it works
class BasicController < ActionController::Base
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"render_action/basic/hello_world.html.erb" => "Hello world!"
)]
@@ -117,7 +117,7 @@ module RenderActionWithApplicationLayout
# # ==== Render actions with layouts ====
class BasicController < ::ApplicationController
# Set the view path to an application view structure with layouts
- self.view_paths = self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = self.view_paths = [ActionView::FixtureResolver.new(
"render_action_with_application_layout/basic/hello_world.html.erb" => "Hello World!",
"render_action_with_application_layout/basic/hello.html.builder" => "xml.p 'Omg'",
"layouts/application.html.erb" => "OHAI <%= yield %> KTHXBAI",
@@ -202,7 +202,7 @@ end
module RenderActionWithControllerLayout
class BasicController < ActionController::Base
- self.view_paths = self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = self.view_paths = [ActionView::FixtureResolver.new(
"render_action_with_controller_layout/basic/hello_world.html.erb" => "Hello World!",
"layouts/render_action_with_controller_layout/basic.html.erb" => "With Controller Layout! <%= yield %> KTHXBAI"
)]
@@ -263,7 +263,7 @@ end
module RenderActionWithBothLayouts
class BasicController < ActionController::Base
- self.view_paths = [ActionView::Template::FixturePath.new({
+ self.view_paths = [ActionView::FixtureResolver.new({
"render_action_with_both_layouts/basic/hello_world.html.erb" => "Hello World!",
"layouts/application.html.erb" => "OHAI <%= yield %> KTHXBAI",
"layouts/render_action_with_both_layouts/basic.html.erb" => "With Controller Layout! <%= yield %> KTHXBAI"
diff --git a/actionpack/test/new_base/render_implicit_action_test.rb b/actionpack/test/new_base/render_implicit_action_test.rb
index 2846df48da..fd96e1955f 100644
--- a/actionpack/test/new_base/render_implicit_action_test.rb
+++ b/actionpack/test/new_base/render_implicit_action_test.rb
@@ -2,7 +2,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
module RenderImplicitAction
class SimpleController < ::ApplicationController
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"render_implicit_action/simple/hello_world.html.erb" => "Hello world!",
"render_implicit_action/simple/hyphen-ated.html.erb" => "Hello hyphen-ated!"
)]
diff --git a/actionpack/test/new_base/render_layout_test.rb b/actionpack/test/new_base/render_layout_test.rb
index f32c60d683..279b807a5f 100644
--- a/actionpack/test/new_base/render_layout_test.rb
+++ b/actionpack/test/new_base/render_layout_test.rb
@@ -2,7 +2,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
module ControllerLayouts
class ImplicitController < ::ApplicationController
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"layouts/application.html.erb" => "OMG <%= yield %> KTHXBAI",
"layouts/override.html.erb" => "Override! <%= yield %>",
"basic.html.erb" => "Hello world!",
@@ -26,7 +26,7 @@ module ControllerLayouts
end
class ImplicitNameController < ::ApplicationController
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"layouts/controller_layouts/implicit_name.html.erb" => "OMGIMPLICIT <%= yield %> KTHXBAI",
"basic.html.erb" => "Hello world!"
)]
@@ -68,7 +68,7 @@ module ControllerLayouts
end
class MismatchFormatController < ::ApplicationController
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"layouts/application.html.erb" => "<html><%= yield %></html>",
"controller_layouts/mismatch_format/index.js.rjs" => "page[:test].omg",
"controller_layouts/mismatch_format/implicit.rjs" => "page[:test].omg"
diff --git a/actionpack/test/new_base/render_partial_test.rb b/actionpack/test/new_base/render_partial_test.rb
index 3a300afe5c..bbb98a0c01 100644
--- a/actionpack/test/new_base/render_partial_test.rb
+++ b/actionpack/test/new_base/render_partial_test.rb
@@ -4,7 +4,7 @@ module RenderPartial
class BasicController < ActionController::Base
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"render_partial/basic/_basic.html.erb" => "OMG!",
"render_partial/basic/basic.html.erb" => "<%= @test_unchanged = 'goodbye' %><%= render :partial => 'basic' %><%= @test_unchanged %>"
)]
diff --git a/actionpack/test/new_base/render_rjs_test.rb b/actionpack/test/new_base/render_rjs_test.rb
new file mode 100644
index 0000000000..bd4c87b3bf
--- /dev/null
+++ b/actionpack/test/new_base/render_rjs_test.rb
@@ -0,0 +1,46 @@
+require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
+
+module RenderRjs
+
+ class BasicController < ActionController::Base
+
+ self.view_paths = [ActionView::FixtureResolver.new(
+ "render_rjs/basic/index.js.rjs" => "page[:customer].replace_html render(:partial => 'customer')",
+ "render_rjs/basic/index_html.js.rjs" => "page[:customer].replace_html :partial => 'customer'",
+ "render_rjs/basic/_customer.js.erb" => "JS Partial",
+ "render_rjs/basic/_customer.html.erb" => "HTML Partial",
+ "render_rjs/basic/index_locale.js.rjs" => "page[:customer].replace_html :partial => 'customer'",
+ "render_rjs/basic/_customer.da.html.erb" => "Danish HTML Partial",
+ "render_rjs/basic/_customer.da.js.erb" => "Danish JS Partial"
+ )]
+
+ def index
+ render
+ end
+
+ def index_locale
+ old_locale, I18n.locale = I18n.locale, :da
+ end
+
+ end
+
+ class TestBasic < SimpleRouteCase
+ testing BasicController
+
+ test "rendering a partial in an RJS template should pick the JS template over the HTML one" do
+ get :index
+ assert_response("$(\"customer\").update(\"JS Partial\");")
+ end
+
+ test "replacing an element with a partial in an RJS template should pick the HTML template over the JS one" do
+ get :index_html
+ assert_response("$(\"customer\").update(\"HTML Partial\");")
+ end
+
+ test "replacing an element with a partial in an RJS template with a locale should pick the localed HTML template" do
+ get :index_locale, :format => :js
+ assert_response("$(\"customer\").update(\"Danish HTML Partial\");")
+ end
+
+ end
+end \ No newline at end of file
diff --git a/actionpack/test/new_base/render_template_test.rb b/actionpack/test/new_base/render_template_test.rb
index face5b7571..94ea38fc7b 100644
--- a/actionpack/test/new_base/render_template_test.rb
+++ b/actionpack/test/new_base/render_template_test.rb
@@ -3,7 +3,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
module RenderTemplate
class WithoutLayoutController < ActionController::Base
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"test/basic.html.erb" => "Hello from basic.html.erb",
"shared.html.erb" => "Elastica",
"locals.html.erb" => "The secret is <%= secret %>",
@@ -79,7 +79,7 @@ module RenderTemplate
end
class WithLayoutController < ::ApplicationController
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"test/basic.html.erb" => "Hello from basic.html.erb",
"shared.html.erb" => "Elastica",
"layouts/application.html.erb" => "<%= yield %>, I'm here!",
@@ -148,7 +148,7 @@ module RenderTemplate
module Compatibility
class WithoutLayoutController < ActionController::Base
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"test/basic.html.erb" => "Hello from basic.html.erb",
"shared.html.erb" => "Elastica"
)]
diff --git a/actionpack/test/new_base/render_test.rb b/actionpack/test/new_base/render_test.rb
index ed3d50fa0b..5783b4766a 100644
--- a/actionpack/test/new_base/render_test.rb
+++ b/actionpack/test/new_base/render_test.rb
@@ -2,7 +2,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
module Render
class BlankRenderController < ActionController::Base
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"render/blank_render/index.html.erb" => "Hello world!",
"render/blank_render/access_request.html.erb" => "The request: <%= request.method.to_s.upcase %>",
"render/blank_render/access_action_name.html.erb" => "Action Name: <%= action_name %>",
diff --git a/actionpack/test/new_base/render_text_test.rb b/actionpack/test/new_base/render_text_test.rb
index 4a90eaac40..84f77432c9 100644
--- a/actionpack/test/new_base/render_text_test.rb
+++ b/actionpack/test/new_base/render_text_test.rb
@@ -2,7 +2,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
module RenderText
class SimpleController < ActionController::Base
- self.view_paths = [ActionView::Template::FixturePath.new]
+ self.view_paths = [ActionView::FixtureResolver.new]
def index
render :text => "hello david"
@@ -10,7 +10,7 @@ module RenderText
end
class WithLayoutController < ::ApplicationController
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"layouts/application.html.erb" => "<%= yield %>, I'm here!",
"layouts/greetings.html.erb" => "<%= yield %>, I wish thee well.",
"layouts/ivar.html.erb" => "<%= yield %>, <%= @ivar %>"
diff --git a/actionpack/test/new_base/render_xml_test.rb b/actionpack/test/new_base/render_xml_test.rb
index e6c40b1533..a3890ddfb2 100644
--- a/actionpack/test/new_base/render_xml_test.rb
+++ b/actionpack/test/new_base/render_xml_test.rb
@@ -4,7 +4,7 @@ module RenderXml
# This has no layout and it works
class BasicController < ActionController::Base
- self.view_paths = [ActionView::Template::FixturePath.new(
+ self.view_paths = [ActionView::FixtureResolver.new(
"render_xml/basic/with_render_erb" => "Hello world!"
)]
end