mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-11-27 00:03:06 -05:00
Always initialize original_values ivar in StripeObject
This is kind of a weird one because it'll only cause a failure when serializing a subobject or hash of a `StripeObject`, but it's good practice to initialize instance variables anyway. Fixes #360.
This commit is contained in:
parent
121a8bfee4
commit
2564990aa2
@ -12,6 +12,7 @@ module Stripe
|
||||
def initialize(id=nil, opts={})
|
||||
id, @retrieve_params = Util.normalize_id(id)
|
||||
@opts = Util.normalize_opts(opts)
|
||||
@original_values = {}
|
||||
@values = {}
|
||||
# This really belongs in APIResource, but not putting it there allows us
|
||||
# to have a unified inspect method
|
||||
|
||||
@ -105,6 +105,13 @@ module Stripe
|
||||
assert_equal({}, Stripe::StripeObject.serialize_params(obj))
|
||||
end
|
||||
|
||||
should "#serialize_params on a new object with a subobject" do
|
||||
obj = Stripe::StripeObject.new
|
||||
obj.metadata = { :foo => "bar" }
|
||||
assert_equal({ :metadata => { :foo => "bar" } },
|
||||
Stripe::StripeObject.serialize_params(obj))
|
||||
end
|
||||
|
||||
should "#serialize_params on a basic object" do
|
||||
obj = Stripe::StripeObject.construct_from({ :foo => nil })
|
||||
obj.update_attributes(:foo => "bar")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user