test/stripe/stripe_object_test.rb in stripe-5.30.0 vs test/stripe/stripe_object_test.rb in stripe-5.31.0
- old
+ new
@@ -494,7 +494,17 @@
should "call Object#method if an argument is provided" do
obj = Stripe::StripeObject.construct_from(id: 1, method: "foo")
assert obj.method(:id).is_a?(Method)
end
end
+
+ should "ignore properties that are reserved names" do
+ obj = Stripe::StripeObject.construct_from(metadata: { class: "something" })
+
+ # See comment on `StripeObject::RESERVED_FIELD_NAMES`
+ assert_equal Stripe::StripeObject, obj.metadata.class
+
+ # Value still accessible with hash syntax
+ assert_equal "something", obj.metadata[:class]
+ end
end
end