Namespace
Methods
- T
-
- test_deprecated_xml_http_request_get,
- test_generate_url_with_controller,
- test_get,
- test_get_with_parameters,
- test_get_with_query_string,
- test_get_xml_rss_atom,
- test_head,
- test_https_and_port_via_host_and_https!,
- test_https_and_port_via_process,
- test_port_via_host!,
- test_port_via_process,
- test_post,
- test_redirect,
- test_request_with_bad_format,
- test_respect_removal_of_default_headers_by_a_controller_action,
- test_xml_http_request_get
Instance Public methods
test_deprecated_xml_http_request_get()
Link
# File actionpack/test/controller/integration_test.rb, line 579 def test_deprecated_xml_http_request_get with_test_route_set do assert_deprecated { 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
test_generate_url_with_controller()
Link
test_get()
Link
# File actionpack/test/controller/integration_test.rb, line 449 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 Nokogiri::HTML::Document, html_document assert_equal 1, request_count end end
test_get_with_parameters()
Link
# File actionpack/test/controller/integration_test.rb, line 614 def test_get_with_parameters with_test_route_set do get '/get_with_params', 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()
Link
# File actionpack/test/controller/integration_test.rb, line 600 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_get_xml_rss_atom()
Link
# File actionpack/test/controller/integration_test.rb, line 465 def test_get_xml_rss_atom %w[ application/xml application/rss+xml application/atom+xml ].each do |mime_string| with_test_route_set do get "/get", headers: {"HTTP_ACCEPT" => mime_string} 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 "<root></root>", body assert_equal "<root></root>", response.body assert_instance_of Nokogiri::XML::Document, html_document assert_equal 1, request_count end end end
test_head()
Link
# File actionpack/test/controller/integration_test.rb, line 628 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_https_and_port_via_host_and_https!()
Link
# File actionpack/test/controller/integration_test.rb, line 667 def test_https_and_port_via_host_and_https! with_test_route_set do host! 'www.example.com' https! true get '/get' assert_equal 443, request.port assert_equal true, request.ssl? host! 'www.example.com:443' https! true get '/get' assert_equal 443, request.port assert_equal true, request.ssl? host! 'www.example.com:8443' https! true get '/get' assert_equal 8443, request.port assert_equal true, request.ssl? end end
test_https_and_port_via_process()
Link
# File actionpack/test/controller/integration_test.rb, line 692 def test_https_and_port_via_process with_test_route_set do get 'https://www.example.com/get' assert_equal 443, request.port assert_equal true, request.ssl? get 'https://www.example.com:8443/get' assert_equal 8443, request.port assert_equal true, request.ssl? end end
test_port_via_host!()
Link
test_port_via_process()
Link
test_post()
Link
# File actionpack/test/controller/integration_test.rb, line 483 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 Nokogiri::HTML::Document, html_document assert_equal 1, request_count end end
test_redirect()
Link
# File actionpack/test/controller/integration_test.rb, line 545 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 Nokogiri::HTML::Document, html_document assert_equal 1, request_count follow_redirect! assert_response :success assert_equal "/get", path get '/moved' assert_response :redirect assert_redirected_to '/method' end end
test_request_with_bad_format()
Link
test_respect_removal_of_default_headers_by_a_controller_action()
Link
# File actionpack/test/controller/integration_test.rb, line 704 def test_respect_removal_of_default_headers_by_a_controller_action with_test_route_set do with_default_headers 'a' => '1', 'b' => '2' do get '/remove_header', params: { header: 'a' } end end assert_not_includes @response.headers, 'a', 'Response should not include default header removed by the controller action' assert_includes @response.headers, 'b' assert_includes @response.headers, 'c' end
test_xml_http_request_get()
Link
# File actionpack/test/controller/integration_test.rb, line 567 def test_xml_http_request_get with_test_route_set do get '/get', xhr: true 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