Namespace
Methods
T
Instance Public methods
test_generate_url_with_controller()
# File actionpack/test/controller/integration_test.rb, line 422
def test_generate_url_with_controller
  assert_equal 'http://www.example.com/foo', url_for(:controller => "foo")
end
test_get()
# File actionpack/test/controller/integration_test.rb, line 262
def test_get
  with_test_route_set do
    get '/get'
    assert_equal 200, status
    assert_equal "OK", status_message
    assert_response 200
    assert_response :success
    assert_response :ok
    assert_equal({}, cookies.to_hash)
    assert_equal "OK", body
    assert_equal "OK", response.body
    assert_kind_of HTML::Document, html_document
    assert_equal 1, request_count
  end
end
test_get_with_parameters()
# File actionpack/test/controller/integration_test.rb, line 388
def test_get_with_parameters
  with_test_route_set do
    get '/get_with_params', :foo => "bar"
    assert_equal '/get_with_params', request.env["PATH_INFO"]
    assert_equal '/get_with_params', request.path_info
    assert_equal 'foo=bar', request.env["QUERY_STRING"]
    assert_equal 'foo=bar', request.query_string
    assert_equal 'bar', request.parameters['foo']

    assert_equal 200, status
    assert_equal "foo: bar", response.body
  end
end
test_get_with_query_string()
# File actionpack/test/controller/integration_test.rb, line 374
def test_get_with_query_string
  with_test_route_set do
    get '/get_with_params?foo=bar'
    assert_equal '/get_with_params?foo=bar', request.env["REQUEST_URI"]
    assert_equal '/get_with_params?foo=bar', request.fullpath
    assert_equal "foo=bar", request.env["QUERY_STRING"]
    assert_equal 'foo=bar', request.query_string
    assert_equal 'bar', request.parameters['foo']

    assert_equal 200, status
    assert_equal "foo: bar", response.body
  end
end
test_head()
# File actionpack/test/controller/integration_test.rb, line 402
def test_head
  with_test_route_set do
    head '/get'
    assert_equal 200, status
    assert_equal "", body

    head '/post'
    assert_equal 201, status
    assert_equal "", body

    get '/get/method'
    assert_equal 200, status
    assert_equal "method: get", body

    head '/get/method'
    assert_equal 200, status
    assert_equal "", body
  end
end
test_post()
# File actionpack/test/controller/integration_test.rb, line 278
def test_post
  with_test_route_set do
    post '/post'
    assert_equal 201, status
    assert_equal "Created", status_message
    assert_response 201
    assert_response :success
    assert_response :created
    assert_equal({}, cookies.to_hash)
    assert_equal "Created", body
    assert_equal "Created", response.body
    assert_kind_of HTML::Document, html_document
    assert_equal 1, request_count
  end
end
test_redirect()
# File actionpack/test/controller/integration_test.rb, line 344
def test_redirect
  with_test_route_set do
    get '/redirect'
    assert_equal 302, status
    assert_equal "Found", status_message
    assert_response 302
    assert_response :redirect
    assert_response :found
    assert_equal "<html><body>You are being <a href=\"http://www.example.com/get\">redirected</a>.</body></html>", response.body
    assert_kind_of HTML::Document, html_document
    assert_equal 1, request_count

    follow_redirect!
    assert_response :success
    assert_equal "/get", path
  end
end
test_xml_http_request_get()
# File actionpack/test/controller/integration_test.rb, line 362
def test_xml_http_request_get
  with_test_route_set do
    xhr :get, '/get'
    assert_equal 200, status
    assert_equal "OK", status_message
    assert_response 200
    assert_response :success
    assert_response :ok
    assert_equal "JS OK", response.body
  end
end