@@ -583,9 +583,7 @@ def test_xml_version_of_resource_is_treated_as_different_cache
583583 assert fragment_exist? ( "hostname.com/action_caching_test/index.xml" )
584584
585585 get :index , format : "xml"
586- assert_response :success
587- assert_equal cached_time , @response . body
588- assert_equal "application/xml" , @response . content_type
586+ assert_cached ( cached_time , "application/xml" )
589587
590588 get :expire_xml
591589 assert_response :success
@@ -604,7 +602,12 @@ def test_correct_content_type_is_returned_for_cache_hit
604602 get :index , params : { id : "content-type" } , format : "xml"
605603 get :index , params : { id : "content-type" } , format : "xml"
606604 assert_response :success
607- assert_equal "application/xml" , @response . content_type
605+
606+ if @response . respond_to? ( :media_type )
607+ assert_equal "application/xml" , @response . media_type
608+ else
609+ assert_equal "application/xml" , @response . content_type
610+ end
608611 end
609612
610613 def test_correct_content_type_is_returned_for_cache_hit_on_action_with_string_key
@@ -616,7 +619,12 @@ def test_correct_content_type_is_returned_for_cache_hit_on_action_with_string_ke
616619 get :show , format : "xml"
617620 get :show , format : "xml"
618621 assert_response :success
619- assert_equal "application/xml" , @response . content_type
622+
623+ if @response . respond_to? ( :media_type )
624+ assert_equal "application/xml" , @response . media_type
625+ else
626+ assert_equal "application/xml" , @response . content_type
627+ end
620628 end
621629
622630 def test_correct_content_type_is_returned_for_cache_hit_on_action_with_string_key_from_proc
@@ -628,7 +636,12 @@ def test_correct_content_type_is_returned_for_cache_hit_on_action_with_string_ke
628636 get :edit , params : { id : 1 } , format : "xml"
629637 get :edit , params : { id : 1 } , format : "xml"
630638 assert_response :success
631- assert_equal "application/xml" , @response . content_type
639+
640+ if @response . respond_to? ( :media_type )
641+ assert_equal "application/xml" , @response . media_type
642+ else
643+ assert_equal "application/xml" , @response . content_type
644+ end
632645 end
633646
634647 def test_empty_path_is_normalized
@@ -851,16 +864,26 @@ def get_json(*args)
851864 get ( *args )
852865 end
853866
854- def assert_cached ( cache_time , content_type = "text/html" )
867+ def assert_cached ( cache_time , media_type = "text/html" )
855868 assert_response :success
856869 assert_equal cache_time , @response . body
857- assert_equal content_type , @response . content_type
870+
871+ if @response . respond_to? ( :media_type )
872+ assert_equal media_type , @response . media_type
873+ else
874+ assert_equal media_type , @response . contenty_type
875+ end
858876 end
859877
860- def assert_not_cached ( cache_time , content_type = "text/html" )
878+ def assert_not_cached ( cache_time , media_type = "text/html" )
861879 assert_response :success
862880 assert_not_equal cache_time , @response . body
863- assert_equal content_type , @response . content_type
881+
882+ if @response . respond_to? ( :media_type )
883+ assert_equal media_type , @response . media_type
884+ else
885+ assert_equal media_type , @response . contenty_type
886+ end
864887 end
865888
866889 def content_to_cache
0 commit comments