class HeadRenderTest
Public Instance Methods
setup()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 646 def setup @request.host = "www.nextangle.com" end
test_head_created()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 650 def test_head_created post :head_created assert @response.body.blank? assert_response :created end
test_head_created_with_application_json_content_type()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 656 def test_head_created_with_application_json_content_type post :head_created_with_application_json_content_type assert @response.body.blank? assert_equal "application/json", @response.header["Content-Type"] assert_response :created end
test_head_ok_with_image_png_content_type()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 663 def test_head_ok_with_image_png_content_type post :head_ok_with_image_png_content_type assert @response.body.blank? assert_equal "image/png", @response.header["Content-Type"] assert_response :ok end
test_head_returns_truthy_value()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 759 def test_head_returns_truthy_value assert_nothing_raised do get :head_and_return end end
test_head_with_custom_header()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 694 def test_head_with_custom_header get :head_with_custom_header assert @response.body.blank? assert_equal "something", @response.headers["X-Custom-Header"] assert_response :ok end
test_head_with_integer_status()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 729 def test_head_with_integer_status Rack::Utils::HTTP_STATUS_CODES.each do |code, message| get :head_with_integer_status, params: { status: code.to_s } assert_equal message, @response.message end end
test_head_with_location_header()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 670 def test_head_with_location_header get :head_with_location_header assert @response.body.blank? assert_equal "/foo", @response.headers["Location"] assert_response :ok end
test_head_with_location_object()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 677 def test_head_with_location_object with_routing do |set| set.draw do resources :customers ActiveSupport::Deprecation.silence do get ":controller/:action" end end get :head_with_location_object assert @response.body.blank? assert_equal "http://www.nextangle.com/customers/1", @response.headers["Location"] assert_response :ok end end
test_head_with_no_content()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 736 def test_head_with_no_content get :head_with_no_content assert_equal 204, @response.status assert_nil @response.headers["Content-Type"] assert_nil @response.headers["Content-Length"] end
test_head_with_status_code_first()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 751 def test_head_with_status_code_first get :head_with_status_code_first assert_equal 403, @response.response_code assert_equal "Forbidden", @response.message assert_equal "something", @response.headers["X-Custom-Header"] assert_response :forbidden end
test_head_with_string_status()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 744 def test_head_with_string_status get :head_with_string_status, params: { status: "404 Eat Dirt" } assert_equal 404, @response.response_code assert_equal "Not Found", @response.message assert_response :not_found end
test_head_with_symbolic_status()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 708 def test_head_with_symbolic_status get :head_with_symbolic_status, params: { status: "ok" } assert_equal 200, @response.status assert_response :ok get :head_with_symbolic_status, params: { status: "not_found" } assert_equal 404, @response.status assert_response :not_found get :head_with_symbolic_status, params: { status: "no_content" } assert_equal 204, @response.status assert_not_includes @response.headers, "Content-Length" assert_response :no_content Rack::Utils::SYMBOL_TO_STATUS_CODE.each do |status, code| get :head_with_symbolic_status, params: { status: status.to_s } assert_equal code, @response.response_code assert_response status end end
test_head_with_www_authenticate_header()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 701 def test_head_with_www_authenticate_header get :head_with_www_authenticate_header assert @response.body.blank? assert_equal "something", @response.headers["WWW-Authenticate"] assert_response :ok end