@@ -19,23 +19,25 @@ def self.where_api_endpoint
1919 describe "with different variable types" do
2020 let ( :variables ) do
2121 {
22- "string_var" => "hello" ,
23- "array_var" => [ 1 , 2 , 3 ] ,
24- "hash_var" => { "foo" => "bar" } ,
25- "number_var" => 42 ,
26- "boolean_var" => true
22+ string_var : "hello" ,
23+ array_var : [ 1 , 2 , 3 ] ,
24+ array_of_strings : [ "foo" , "bar" ] ,
25+ hash_var : { "foo" => "bar" } ,
26+ number_var : 42 ,
27+ boolean_var : true
2728 }
2829 end
2930
3031 it "properly serializes variables in the query string" do
3132 uri = subject . send ( :uri )
32- query_params = URI . decode_www_form ( uri . query ) . to_h
33-
34- assert_equal "\" hello\" " , query_params [ "$string_var" ]
35- assert_equal "[1,2,3]" , query_params [ "$array_var" ]
36- assert_equal "{\" foo\" :\" bar\" }" , query_params [ "$hash_var" ]
37- assert_equal "42" , query_params [ "$number_var" ]
38- assert_equal "true" , query_params [ "$boolean_var" ]
33+ decoded_query = URI . decode_www_form_component ( uri . query )
34+
35+ assert_includes decoded_query , "$string_var=\" hello\" "
36+ assert_includes decoded_query , "$array_var=[1,2,3]"
37+ assert_includes decoded_query , "$array_of_strings=[\" foo\" ,\" bar\" ]"
38+ assert_includes decoded_query , "$hash_var={\" foo\" :\" bar\" }"
39+ assert_includes decoded_query , "$number_var=42"
40+ assert_includes decoded_query , "$boolean_var=true"
3941 end
4042 end
4143 end
0 commit comments