aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorMatt Jones <al2o3cr@gmail.com>2009-02-24 10:38:07 -0600
committerJoshua Peek <josh@joshpeek.com>2009-02-24 10:38:07 -0600
commitb35562f432d0807517a614a540026c2fc557e2ac (patch)
tree5b6b797ce782ced42463793c7d1aa6d293d2b8d1 /actionpack/test
parent53cd102b39eb62567298430cbd94e40dd78d46a0 (diff)
downloadrails-b35562f432d0807517a614a540026c2fc557e2ac.tar.gz
rails-b35562f432d0807517a614a540026c2fc557e2ac.tar.bz2
rails-b35562f432d0807517a614a540026c2fc557e2ac.zip
correctly handle layouts for AJAX requests and regular js files [#2052 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/render_test.rb9
-rw-r--r--actionpack/test/fixtures/layouts/xhr.html.erb2
2 files changed, 7 insertions, 4 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index e131a735a9..70e5e62c93 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -684,12 +684,13 @@ class TestController < ActionController::Base
"render_with_explicit_string_template",
"render_js_with_explicit_template",
"render_js_with_explicit_action_template",
- "delete_with_js", "update_page", "update_page_with_instance_variables",
- "render_implicit_js_template_without_layout"
+ "delete_with_js", "update_page", "update_page_with_instance_variables"
"layouts/standard"
when "action_talk_to_layout", "layout_overriding_layout"
"layouts/talk_from_action"
+ when "render_implicit_html_template_from_xhr_request"
+ (request.xhr? ? 'layouts/xhr' : 'layouts/standard')
end
end
end
@@ -1018,8 +1019,8 @@ class RenderTest < ActionController::TestCase
end
def test_should_implicitly_render_html_template_from_xhr_request
- get :render_implicit_html_template_from_xhr_request, :format => :js
- assert_equal "Hello HTML!", @response.body
+ xhr :get, :render_implicit_html_template_from_xhr_request
+ assert_equal "XHR!\nHello HTML!", @response.body
end
def test_should_implicitly_render_js_template_without_layout
diff --git a/actionpack/test/fixtures/layouts/xhr.html.erb b/actionpack/test/fixtures/layouts/xhr.html.erb
new file mode 100644
index 0000000000..85285324ec
--- /dev/null
+++ b/actionpack/test/fixtures/layouts/xhr.html.erb
@@ -0,0 +1,2 @@
+XHR!
+<%= yield %> \ No newline at end of file