/
payout_test.rb
72 lines (62 loc) · 1.96 KB
/
payout_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# frozen_string_literal: true
require ::File.expand_path("../test_helper", __dir__)
module Stripe
class PayoutTest < Test::Unit::TestCase
should "be listable" do
payouts = Stripe::Payout.list
assert_requested :get, "#{Stripe.api_base}/v1/payouts"
assert payouts.data.is_a?(Array)
assert payouts.data[0].is_a?(Stripe::Payout)
end
should "be retrievable" do
payout = Stripe::Payout.retrieve("tr_123")
assert_requested :get, "#{Stripe.api_base}/v1/payouts/tr_123"
assert payout.is_a?(Stripe::Payout)
end
should "be creatable" do
payout = Stripe::Payout.create(
amount: 100,
currency: "USD"
)
assert_requested :post, "#{Stripe.api_base}/v1/payouts"
assert payout.is_a?(Stripe::Payout)
end
should "be saveable" do
payout = Stripe::Payout.retrieve("tr_123")
payout.metadata["key"] = "value"
payout.save
assert_requested :post, "#{Stripe.api_base}/v1/payouts/#{payout.id}"
end
should "be updateable" do
payout = Stripe::Payout.update("tr_123", metadata: { foo: "bar" })
assert_requested :post, "#{Stripe.api_base}/v1/payouts/tr_123"
assert payout.is_a?(Stripe::Payout)
end
context "#cancel" do
should "cancel a payout" do
payout = Stripe::Payout.retrieve("tr_123")
payout = payout.cancel
assert payout.is_a?(Stripe::Payout)
end
end
context ".cancel" do
should "cancel a payout" do
payout = Stripe::Payout.cancel("pm_123")
assert payout.is_a?(Stripe::Payout)
end
end
context "#reverse" do
should "reverse a payout" do
payout = Stripe::Payout.retrieve("tr_123")
payout = payout.reverse
assert payout.is_a?(Stripe::Payout)
end
end
context ".reverse" do
should "reverse a payout" do
payout = Stripe::Payout.reverse("pm_123")
assert payout.is_a?(Stripe::Payout)
end
end
end
end