@@ -583,9 +583,7 @@ def test_xml_version_of_resource_is_treated_as_different_cache
583
583
assert fragment_exist? ( "hostname.com/action_caching_test/index.xml" )
584
584
585
585
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" )
589
587
590
588
get :expire_xml
591
589
assert_response :success
@@ -604,7 +602,12 @@ def test_correct_content_type_is_returned_for_cache_hit
604
602
get :index , params : { id : "content-type" } , format : "xml"
605
603
get :index , params : { id : "content-type" } , format : "xml"
606
604
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
608
611
end
609
612
610
613
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
616
619
get :show , format : "xml"
617
620
get :show , format : "xml"
618
621
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
620
628
end
621
629
622
630
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
628
636
get :edit , params : { id : 1 } , format : "xml"
629
637
get :edit , params : { id : 1 } , format : "xml"
630
638
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
632
645
end
633
646
634
647
def test_empty_path_is_normalized
@@ -851,16 +864,26 @@ def get_json(*args)
851
864
get ( *args )
852
865
end
853
866
854
- def assert_cached ( cache_time , content_type = "text/html" )
867
+ def assert_cached ( cache_time , media_type = "text/html" )
855
868
assert_response :success
856
869
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
858
876
end
859
877
860
- def assert_not_cached ( cache_time , content_type = "text/html" )
878
+ def assert_not_cached ( cache_time , media_type = "text/html" )
861
879
assert_response :success
862
880
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
864
887
end
865
888
866
889
def content_to_cache
0 commit comments