diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-08-19 18:53:46 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-08-19 18:53:46 -0500 |
commit | 71c4ff07ab4313c1f4781d59ad2f4528f5875665 (patch) | |
tree | e67348ef53061f3bf4402d73e91718f58a25a2a1 /actionpack | |
parent | 5df8ff1d6b6c35a7b5924f95ad12693984323513 (diff) | |
download | rails-71c4ff07ab4313c1f4781d59ad2f4528f5875665.tar.gz rails-71c4ff07ab4313c1f4781d59ad2f4528f5875665.tar.bz2 rails-71c4ff07ab4313c1f4781d59ad2f4528f5875665.zip |
Delegate xhr helper method to integration session
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/integration.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/integration_test.rb | 19 |
2 files changed, 19 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb index 1d2b81355c..ca5923de2f 100644 --- a/actionpack/lib/action_controller/integration.rb +++ b/actionpack/lib/action_controller/integration.rb @@ -451,7 +451,7 @@ EOF end %w(get post put head delete cookies assigns - xml_http_request get_via_redirect post_via_redirect).each do |method| + xml_http_request xhr get_via_redirect post_via_redirect).each do |method| define_method(method) do |*args| reset! unless @integration_session # reset the html_document variable, but only for new get/post calls diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index a709343a94..b878962df3 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -253,7 +253,10 @@ class IntegrationProcessTest < ActionController::IntegrationTest session :off def get - render :text => "OK", :status => 200 + respond_to do |format| + format.html { render :text => "OK", :status => 200 } + format.js { render :text => "JS OK", :status => 200 } + end end def post @@ -345,6 +348,20 @@ class IntegrationProcessTest < ActionController::IntegrationTest end end + def test_xml_http_request_get + with_test_route_set do + xhr :get, '/get' + assert_equal 200, status + assert_equal "OK", status_message + assert_equal "200 OK", response.headers["Status"] + assert_equal ["200 OK"], headers["status"] + assert_response 200 + assert_response :success + assert_response :ok + assert_equal "JS OK", response.body + end + end + private def with_test_route_set with_routing do |set| |