Sort encoded parameters for stability in 1.8.7 tests

This commit is contained in:
Brandur 2015-10-06 14:16:45 -07:00
parent a48fd12c70
commit 91262c9042
3 changed files with 8 additions and 3 deletions

View File

@ -117,7 +117,12 @@ module Stripe
result << [calculated_key, value]
end
end
result
# The #sort_by call here is mostly so that we can get some stability in
# our 1.8.7 test suite where Hash key order is not preserved.
#
# https://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/
result.sort_by { |(k, _)| k }
end
def self.flatten_params_array(value, calculated_key)

View File

@ -68,7 +68,7 @@ module Stripe
@mock.expects(:post).
once.
with('https://api.stripe.com/v1/accounts/acct_foo', nil, 'legal_entity[first_name]=Bob&legal_entity[address][line1]=2%20Three%20Four').
with('https://api.stripe.com/v1/accounts/acct_foo', nil, 'legal_entity[address][line1]=2%20Three%20Four&legal_entity[first_name]=Bob').
returns(make_response(resp))
a = Stripe::Account.retrieve('acct_foo')

View File

@ -60,7 +60,7 @@ module Stripe
if is_greater_than_ruby_1_9?
check_metadata({:metadata => {:initial => 'true'}},
'metadata[uuid]=6735&metadata[initial]=',
'metadata[initial]=&metadata[uuid]=6735',
update_actions)
end
end