mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-05-31 00:00:37 -04:00
Create accessor methods in update_attributes
This commit is contained in:
parent
7e17330561
commit
4faa7d169f
@ -84,8 +84,8 @@ module Stripe
|
||||
# Default to true. TODO: Convert to optional arguments after we're off
|
||||
# 1.9 which will make this quite a bit more clear.
|
||||
dirty = method_options.fetch(:dirty, true)
|
||||
|
||||
values.each do |k, v|
|
||||
add_accessors([k], values) unless metaclass.method_defined?(k.to_sym)
|
||||
@values[k] = Util.convert_to_stripe_object(v, opts)
|
||||
dirty_value!(@values[k]) if dirty
|
||||
@unsaved_values.add(k)
|
||||
|
@ -90,6 +90,13 @@ module Stripe
|
||||
assert_equal Stripe::StripeObject, obj.metadata.class
|
||||
end
|
||||
|
||||
should "create accessors when #update_attributes is called" do
|
||||
obj = Stripe::StripeObject.construct_from({})
|
||||
assert_equal false, obj.send(:metaclass).method_defined?(:foo)
|
||||
obj.update_attributes(:foo => 'bar')
|
||||
assert_equal true, obj.send(:metaclass).method_defined?(:foo)
|
||||
end
|
||||
|
||||
should "warn that #refresh_from is deprecated" do
|
||||
old_stderr = $stderr
|
||||
$stderr = StringIO.new
|
||||
|
Loading…
x
Reference in New Issue
Block a user