mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-12-07 00:00:35 -05:00
Merge pull request #410 from stripe/brandur-fix-warnings
Fix warnings emitted during tests
This commit is contained in:
commit
c98f555aeb
@ -3,7 +3,6 @@ module Stripe
|
|||||||
module List
|
module List
|
||||||
def list(filters={}, opts={})
|
def list(filters={}, opts={})
|
||||||
opts = Util.normalize_opts(opts)
|
opts = Util.normalize_opts(opts)
|
||||||
opts = @opts.merge(opts) if @opts
|
|
||||||
|
|
||||||
response, opts = request(:get, resource_url, filters, opts)
|
response, opts = request(:get, resource_url, filters, opts)
|
||||||
obj = ListObject.construct_from(response, opts)
|
obj = ListObject.construct_from(response, opts)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ module Stripe
|
|||||||
# an `Array` and fall back to the old refund URL if necessary so as to
|
# an `Array` and fall back to the old refund URL if necessary so as to
|
||||||
# maintain internal compatibility.
|
# maintain internal compatibility.
|
||||||
unless self.refunds.is_a?(Array)
|
unless self.refunds.is_a?(Array)
|
||||||
refund = self.refunds.create(params, opts)
|
self.refunds.create(params, opts)
|
||||||
|
|
||||||
# now that a refund has been created, we expect the state of this object
|
# now that a refund has been created, we expect the state of this object
|
||||||
# to change as well (i.e. `refunded` will now be `true`) so refresh it
|
# to change as well (i.e. `refunded` will now be `true`) so refresh it
|
||||||
|
|||||||
@ -32,7 +32,7 @@ module Stripe
|
|||||||
# considered to be equal if they have the same set of values and each one
|
# considered to be equal if they have the same set of values and each one
|
||||||
# of those values is the same.
|
# of those values is the same.
|
||||||
def ==(other)
|
def ==(other)
|
||||||
@values == other.instance_variable_get(:@values)
|
other.is_a?(StripeObject) && @values == other.instance_variable_get(:@values)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Indicates whether or not the resource has been deleted on the server.
|
# Indicates whether or not the resource has been deleted on the server.
|
||||||
|
|||||||
@ -12,7 +12,7 @@ module Stripe
|
|||||||
end
|
end
|
||||||
|
|
||||||
def delete_discount
|
def delete_discount
|
||||||
response, opts = request(:delete, discount_url)
|
_, opts = request(:delete, discount_url)
|
||||||
initialize_from({ :discount => nil }, opts, true)
|
initialize_from({ :discount => nil }, opts, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ module Stripe
|
|||||||
include Stripe::APIOperations::Update
|
include Stripe::APIOperations::Update
|
||||||
|
|
||||||
def cancel
|
def cancel
|
||||||
response, api_key = Stripe.request(:post, cancel_url, @api_key)
|
response, api_key = self.request(:post, cancel_url)
|
||||||
initialize_from(response, api_key)
|
initialize_from(response, api_key)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -120,7 +120,7 @@ module Stripe
|
|||||||
|
|
||||||
# do not sort the final output because arrays (and arrays of hashes
|
# do not sort the final output because arrays (and arrays of hashes
|
||||||
# especially) can be order sensitive, but do sort incoming parameters
|
# especially) can be order sensitive, but do sort incoming parameters
|
||||||
params.sort_by { |(k, v)| k.to_s }.each do |key, value|
|
params.sort_by { |(k, _)| k.to_s }.each do |key, value|
|
||||||
calculated_key = parent_key ? "#{parent_key}[#{key}]" : "#{key}"
|
calculated_key = parent_key ? "#{parent_key}[#{key}]" : "#{key}"
|
||||||
if value.is_a?(Hash)
|
if value.is_a?(Hash)
|
||||||
result += flatten_params(value, calculated_key)
|
result += flatten_params(value, calculated_key)
|
||||||
|
|||||||
@ -445,7 +445,7 @@ module Stripe
|
|||||||
opts[:url] == "#{Stripe.api_base}/v1/customers/c_test_customer" &&
|
opts[:url] == "#{Stripe.api_base}/v1/customers/c_test_customer" &&
|
||||||
opts[:headers][:stripe_account] == 'acct_abc'
|
opts[:headers][:stripe_account] == 'acct_abc'
|
||||||
end.once.returns(make_response(make_customer))
|
end.once.returns(make_response(make_customer))
|
||||||
c = Stripe::Customer.retrieve("c_test_customer", {:stripe_account => 'acct_abc'})
|
Stripe::Customer.retrieve("c_test_customer", {:stripe_account => 'acct_abc'})
|
||||||
end
|
end
|
||||||
|
|
||||||
should "passing in a stripe_account header should pass it through on save" do
|
should "passing in a stripe_account header should pass it through on save" do
|
||||||
|
|||||||
@ -47,14 +47,14 @@ module Stripe
|
|||||||
should "delete a bitcoin receiver with no customer through top-level API" do
|
should "delete a bitcoin receiver with no customer through top-level API" do
|
||||||
@mock.expects(:delete).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver", nil, nil).once.returns(make_response({:deleted => true, :id => "btcrcv_test_receiver"}))
|
@mock.expects(:delete).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver", nil, nil).once.returns(make_response({:deleted => true, :id => "btcrcv_test_receiver"}))
|
||||||
receiver = Stripe::BitcoinReceiver.construct_from(make_bitcoin_receiver)
|
receiver = Stripe::BitcoinReceiver.construct_from(make_bitcoin_receiver)
|
||||||
response = receiver.delete
|
receiver.delete
|
||||||
assert(receiver.deleted)
|
assert(receiver.deleted)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "delete a bitcoin receiver with a customer through customer's subresource API" do
|
should "delete a bitcoin receiver with a customer through customer's subresource API" do
|
||||||
@mock.expects(:delete).with("#{Stripe.api_base}/v1/customers/customer_foo/sources/btcrcv_test_receiver", nil, nil).once.returns(make_response({:deleted => true, :id => "btcrcv_test_receiver"}))
|
@mock.expects(:delete).with("#{Stripe.api_base}/v1/customers/customer_foo/sources/btcrcv_test_receiver", nil, nil).once.returns(make_response({:deleted => true, :id => "btcrcv_test_receiver"}))
|
||||||
receiver = Stripe::BitcoinReceiver.construct_from(make_bitcoin_receiver(:customer => 'customer_foo'))
|
receiver = Stripe::BitcoinReceiver.construct_from(make_bitcoin_receiver(:customer => 'customer_foo'))
|
||||||
response = receiver.delete
|
receiver.delete
|
||||||
assert(receiver.deleted)
|
assert(receiver.deleted)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -283,7 +283,7 @@ module Stripe
|
|||||||
e = assert_raises ArgumentError do
|
e = assert_raises ArgumentError do
|
||||||
obj.foo = ""
|
obj.foo = ""
|
||||||
end
|
end
|
||||||
assert_match /\(object\).foo = nil/, e.message
|
assert_match %r{\(object\).foo = nil}, e.message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -13,6 +13,10 @@ module Stripe
|
|||||||
@mock_rest_client = mock_client
|
@mock_rest_client = mock_client
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class << self
|
||||||
|
remove_method :execute_request
|
||||||
|
end
|
||||||
|
|
||||||
def self.execute_request(opts)
|
def self.execute_request(opts)
|
||||||
get_params = (opts[:headers] || {})[:params]
|
get_params = (opts[:headers] || {})[:params]
|
||||||
post_params = opts[:payload]
|
post_params = opts[:payload]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user