Methods
S
T
Instance Public methods
setup()
# File rails/actionpack/test/controller/integration_test.rb, line 24
def setup
  @session = ActionController::Integration::Session.new
end
test_delete()
# File rails/actionpack/test/controller/integration_test.rb, line 123
def test_delete
  path = "/index"; params = "blah"; headers = {:location => 'blah'}
  @session.expects(:process).with(:delete,path,params,headers)
  @session.delete(path,params,headers)
end
test_follow_redirect_calls_get_and_returns_status()
# File rails/actionpack/test/controller/integration_test.rb, line 46
def test_follow_redirect_calls_get_and_returns_status
  @session.stubs(:redirect?).returns(true)
  @session.stubs(:headers).returns({"location" => ["www.google.com"]})
  @session.stubs(:status).returns(200)
  @session.expects(:get)
  assert_equal 200, @session.follow_redirect!
end
test_follow_redirect_raises_when_no_redirect()
# File rails/actionpack/test/controller/integration_test.rb, line 41
def test_follow_redirect_raises_when_no_redirect
  @session.stubs(:redirect?).returns(false)
  assert_raise(RuntimeError) { @session.follow_redirect! }
end
test_get()
# File rails/actionpack/test/controller/integration_test.rb, line 105
def test_get
  path = "/index"; params = "blah"; headers = {:location => 'blah'}
  @session.expects(:process).with(:get,path,params,headers)
  @session.get(path,params,headers)
end
test_get_via_redirect()
# File rails/actionpack/test/controller/integration_test.rb, line 54
def test_get_via_redirect
  path = "/somepath"; args = {:id => '1'}

  @session.expects(:get).with(path,args)

  @session.stubs(:redirect?).returns(true).then.returns(true).then.returns(false)
  @session.expects(:follow_redirect!).times(2)

  @session.stubs(:status).returns(200)
  assert_equal 200, @session.get_via_redirect(path, args)
end
test_head()
# File rails/actionpack/test/controller/integration_test.rb, line 129
def test_head
  path = "/index"; params = "blah"; headers = {:location => 'blah'}
  @session.expects(:process).with(:head,path,params,headers)
  @session.head(path,params,headers)
end
test_host!()
# File rails/actionpack/test/controller/integration_test.rb, line 35
def test_host!
  assert_not_equal "glu.ttono.us", @session.host
  @session.host! "rubyonrails.com"
  assert_equal "rubyonrails.com", @session.host
end
test_https_bang_works_and_sets_truth_by_default()
# File rails/actionpack/test/controller/integration_test.rb, line 27
def test_https_bang_works_and_sets_truth_by_default
  assert !@session.https?
  @session.https!
  assert @session.https?
  @session.https! false
  assert !@session.https?
end
test_post()
# File rails/actionpack/test/controller/integration_test.rb, line 111
def test_post
  path = "/index"; params = "blah"; headers = {:location => 'blah'}
  @session.expects(:process).with(:post,path,params,headers)
  @session.post(path,params,headers)
end
test_post_via_redirect()
# File rails/actionpack/test/controller/integration_test.rb, line 66
def test_post_via_redirect
  path = "/somepath"; args = {:id => '1'}

  @session.expects(:post).with(path,args)

  @session.stubs(:redirect?).returns(true).then.returns(true).then.returns(false)
  @session.expects(:follow_redirect!).times(2)

  @session.stubs(:status).returns(200)
  assert_equal 200, @session.post_via_redirect(path, args)
end
test_put()
# File rails/actionpack/test/controller/integration_test.rb, line 117
def test_put
  path = "/index"; params = "blah"; headers = {:location => 'blah'}
  @session.expects(:process).with(:put,path,params,headers)
  @session.put(path,params,headers)
end
test_redirect_bool_with_status_in_200s()
# File rails/actionpack/test/controller/integration_test.rb, line 100
def test_redirect_bool_with_status_in_200s
  @session.stubs(:status).returns 200
  assert !@session.redirect?
end
test_redirect_bool_with_status_in_300s()
# File rails/actionpack/test/controller/integration_test.rb, line 95
def test_redirect_bool_with_status_in_300s
  @session.stubs(:status).returns 301
  assert @session.redirect?
end
test_url_for_with_controller()
# File rails/actionpack/test/controller/integration_test.rb, line 78
def test_url_for_with_controller
  options = {:action => 'show'}
  mock_controller = mock()
  mock_controller.expects(:url_for).with(options).returns('/show')
  @session.stubs(:controller).returns(mock_controller)
  assert_equal '/show', @session.url_for(options)
end
test_url_for_without_controller()
# File rails/actionpack/test/controller/integration_test.rb, line 86
def test_url_for_without_controller
  options = {:action => 'show'}
  mock_rewriter = mock()
  mock_rewriter.expects(:rewrite).with(options).returns('/show')
  @session.stubs(:generic_url_rewriter).returns(mock_rewriter)
  @session.stubs(:controller).returns(nil)
  assert_equal '/show', @session.url_for(options)
end
test_xml_http_request_delete()
# File rails/actionpack/test/controller/integration_test.rb, line 175
def test_xml_http_request_delete
  path = "/index"; params = "blah"; headers = {:location => 'blah'}
  headers_after_xhr = headers.merge(
    "X-Requested-With" => "XMLHttpRequest",
    "Accept"           => "text/javascript, text/html, application/xml, text/xml, */*"
  )
  @session.expects(:process).with(:delete,path,params,headers_after_xhr)
  @session.xml_http_request(:delete,path,params,headers)
end
test_xml_http_request_deprecated_call()
# File rails/actionpack/test/controller/integration_test.rb, line 135
def test_xml_http_request_deprecated_call
  path = "/index"; params = "blah"; headers = {:location => 'blah'}
  headers_after_xhr = headers.merge(
    "X-Requested-With" => "XMLHttpRequest",
    "Accept"           => "text/javascript, text/html, application/xml, text/xml, */*"
  )
  @session.expects(:process).with(:post,path,params,headers_after_xhr)
  assert_deprecated { @session.xml_http_request(path,params,headers) }
end
test_xml_http_request_get()
# File rails/actionpack/test/controller/integration_test.rb, line 145
def test_xml_http_request_get
  path = "/index"; params = "blah"; headers = {:location => 'blah'}
  headers_after_xhr = headers.merge(
    "X-Requested-With" => "XMLHttpRequest",
    "Accept"           => "text/javascript, text/html, application/xml, text/xml, */*"
  )
  @session.expects(:process).with(:get,path,params,headers_after_xhr)
  @session.xml_http_request(:get,path,params,headers)
end
test_xml_http_request_head()
# File rails/actionpack/test/controller/integration_test.rb, line 185
def test_xml_http_request_head
  path = "/index"; params = "blah"; headers = {:location => 'blah'}
  headers_after_xhr = headers.merge(
    "X-Requested-With" => "XMLHttpRequest",
    "Accept"           => "text/javascript, text/html, application/xml, text/xml, */*"
  )
  @session.expects(:process).with(:head,path,params,headers_after_xhr)
  @session.xml_http_request(:head,path,params,headers)
end
test_xml_http_request_post()
# File rails/actionpack/test/controller/integration_test.rb, line 155
def test_xml_http_request_post
  path = "/index"; params = "blah"; headers = {:location => 'blah'}
  headers_after_xhr = headers.merge(
    "X-Requested-With" => "XMLHttpRequest",
    "Accept"           => "text/javascript, text/html, application/xml, text/xml, */*"
  )
  @session.expects(:process).with(:post,path,params,headers_after_xhr)
  @session.xml_http_request(:post,path,params,headers)
end
test_xml_http_request_put()
# File rails/actionpack/test/controller/integration_test.rb, line 165
def test_xml_http_request_put
  path = "/index"; params = "blah"; headers = {:location => 'blah'}
  headers_after_xhr = headers.merge(
    "X-Requested-With" => "XMLHttpRequest",
    "Accept"           => "text/javascript, text/html, application/xml, text/xml, */*"
  )
  @session.expects(:process).with(:put,path,params,headers_after_xhr)
  @session.xml_http_request(:put,path,params,headers)
end