test/stripe/stripe_object_test.rb in stripe-5.13.0 vs test/stripe/stripe_object_test.rb in stripe-5.14.0
- old
+ new
@@ -210,30 +210,33 @@
assert obj.bool?
end
should "mass assign values with #update_attributes" do
obj = Stripe::StripeObject.construct_from(id: 1, name: "Stripe")
- obj.update_attributes(name: "STRIPE")
+
+ obj.update_attributes({ name: "STRIPE" }) # rubocop:disable Style/BracesAroundHashParameters
+
assert_equal "STRIPE", obj.name
# unfortunately, we even assign unknown properties to duplicate the
# behavior that we currently have via magic accessors with
# method_missing
- obj.update_attributes(unknown: "foo")
+ obj.update_attributes({ unknown: "foo" }) # rubocop:disable Style/BracesAroundHashParameters
+
assert_equal "foo", obj.unknown
end
should "#update_attributes with a hash" do
obj = Stripe::StripeObject.construct_from({})
- obj.update_attributes(metadata: { foo: "bar" })
+ obj.update_attributes({ metadata: { foo: "bar" } }) # rubocop:disable Style/BracesAroundHashParameters
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")
+ obj.update_attributes({ foo: "bar" }) # rubocop:disable Style/BracesAroundHashParameters
assert_equal true, obj.send(:metaclass).method_defined?(:foo)
end
should "pass opts down to children when initializing" do
opts = { custom: "opts" }
@@ -266,10 +269,10 @@
obj.serialize_params)
end
should "#serialize_params on a basic object" do
obj = Stripe::StripeObject.construct_from(foo: nil)
- obj.update_attributes(foo: "bar")
+ obj.update_attributes({ foo: "bar" }) # rubocop:disable Style/BracesAroundHashParameters
assert_equal({ foo: "bar" }, obj.serialize_params)
end
should "#serialize_params on a more complex object" do
obj = Stripe::StripeObject.construct_from(foo: Stripe::StripeObject.construct_from(bar: nil,