@@ -816,6 +816,17 @@ def test_resource_has_only_show_action
816
816
end
817
817
end
818
818
819
+ def test_resource_has_only_show_action_with_string_value
820
+ with_routing do |set |
821
+ set . draw do
822
+ resources :products , only : "show"
823
+ end
824
+
825
+ assert_resource_allowed_routes ( "products" , { } , { id : "1" } , :show , [ :index , :new , :create , :edit , :update , :destroy ] )
826
+ assert_resource_allowed_routes ( "products" , { format : "xml" } , { id : "1" } , :show , [ :index , :new , :create , :edit , :update , :destroy ] )
827
+ end
828
+ end
829
+
819
830
def test_singleton_resource_has_only_show_action
820
831
with_routing do |set |
821
832
set . draw do
@@ -827,6 +838,17 @@ def test_singleton_resource_has_only_show_action
827
838
end
828
839
end
829
840
841
+ def test_singleton_resource_has_only_show_action_with_string_value
842
+ with_routing do |set |
843
+ set . draw do
844
+ resource :account , only : "show"
845
+ end
846
+
847
+ assert_singleton_resource_allowed_routes ( "accounts" , { } , :show , [ :index , :new , :create , :edit , :update , :destroy ] )
848
+ assert_singleton_resource_allowed_routes ( "accounts" , { format : "xml" } , :show , [ :index , :new , :create , :edit , :update , :destroy ] )
849
+ end
850
+ end
851
+
830
852
def test_resource_does_not_have_destroy_action
831
853
with_routing do |set |
832
854
set . draw do
@@ -1113,7 +1135,7 @@ def test_invalid_only_option_for_resources
1113
1135
assert_raise ( ArgumentError , match : expected_message ) do
1114
1136
with_routing do |set |
1115
1137
set . draw do
1116
- resources :products , only : [ :foo , : bar]
1138
+ resources :products , only : [ :foo , " bar" ]
1117
1139
end
1118
1140
end
1119
1141
end
@@ -1124,7 +1146,7 @@ def test_invalid_only_option_for_singleton_resource
1124
1146
assert_raise ( ArgumentError , match : expected_message ) do
1125
1147
with_routing do |set |
1126
1148
set . draw do
1127
- resource :products , only : [ :foo , : bar]
1149
+ resource :products , only : [ :foo , " bar" ]
1128
1150
end
1129
1151
end
1130
1152
end
0 commit comments