braintree 4.26.0 → 4.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,131 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
-
3
- describe Braintree::Disbursement do
4
- describe "new" do
5
- it "is protected" do
6
- expect do
7
- Braintree::Disbursement.new
8
- end.to raise_error(NoMethodError, /protected method .new/)
9
- end
10
- end
11
-
12
- describe "inspect" do
13
- it "prints attributes of disbursement object" do
14
- disbursement = Braintree::Disbursement._new(
15
- :gateway,
16
- :id => "123456",
17
- :merchant_account => {
18
- :id => "sandbox_sub_merchant_account",
19
- :master_merchant_account => {
20
- :id => "sandbox_master_merchant_account",
21
- :status => "active"
22
- },
23
- :status => "active"
24
- },
25
- :transaction_ids => ["sub_merchant_transaction"],
26
- :amount => "100.00",
27
- :disbursement_date => "2013-04-10",
28
- :exception_message => "invalid_account_number",
29
- :follow_up_action => "update",
30
- :retry => false,
31
- :success => false,
32
- )
33
-
34
- expect(disbursement.inspect).to include('id: "123456"')
35
- expect(disbursement.inspect).to include('amount: "100.0"')
36
- expect(disbursement.inspect).to include('exception_message: "invalid_account_number"')
37
- expect(disbursement.inspect).to include("disbursement_date: 2013-04-10")
38
- expect(disbursement.inspect).to include('follow_up_action: "update"')
39
- expect(disbursement.inspect).to include("merchant_account: #<Braintree::MerchantAccount: ")
40
- expect(disbursement.inspect).to include('transaction_ids: ["sub_merchant_transaction"]')
41
- expect(disbursement.inspect).to include("retry: false")
42
- expect(disbursement.inspect).to include("success: false")
43
- end
44
- end
45
-
46
- describe "success?" do
47
- it "is an alias of success" do
48
- disbursement = Braintree::Disbursement._new(
49
- :gateway,
50
- :merchant_account => {
51
- :id => "sandbox_sub_merchant_account",
52
- :master_merchant_account => {
53
- :id => "sandbox_master_merchant_account",
54
- :status => "active"
55
- },
56
- :status => "active"
57
- },
58
- :success => false,
59
- :disbursement_date => "2013-04-10",
60
- )
61
- expect(disbursement.success?).to eq(false)
62
-
63
- disbursement = Braintree::Disbursement._new(
64
- :gateway,
65
- :merchant_account => {
66
- :id => "sandbox_sub_merchant_account",
67
- :master_merchant_account => {
68
- :id => "sandbox_master_merchant_account",
69
- :status => "active"
70
- },
71
- :status => "active"
72
- },
73
- :success => true,
74
- :disbursement_date => "2013-04-10",
75
- )
76
- expect(disbursement.success?).to eq(true)
77
- end
78
- end
79
-
80
- describe "credit?" do
81
- subject do
82
- described_class._new(
83
- :gateway,
84
- merchant_account: {
85
- id: "sandbox_master_merchant_account",
86
- status: "active",
87
- },
88
- success: true,
89
- amount: "100.00",
90
- disbursement_type: type,
91
- disbursement_date: "2013-04-10",
92
- )
93
- end
94
-
95
- context "when the disbursement type is credit" do
96
- let(:type) { described_class::Types::Credit }
97
- it { is_expected.to be_credit }
98
- end
99
-
100
- context "when the disbursement type is not credit" do
101
- let(:type) { described_class::Types::Debit }
102
- it { is_expected.not_to be_credit }
103
- end
104
- end
105
-
106
- describe "debit?" do
107
- subject do
108
- described_class._new(
109
- :gateway,
110
- merchant_account: {
111
- id: "sandbox_master_merchant_account",
112
- status: "active",
113
- },
114
- success: true,
115
- amount: "100.00",
116
- disbursement_type: type,
117
- disbursement_date: "2013-04-10",
118
- )
119
- end
120
-
121
- context "when the disbursement type is debit" do
122
- let(:type) { described_class::Types::Debit }
123
- it { is_expected.to be_debit }
124
- end
125
-
126
- context "when the disbursement type is not debit" do
127
- let(:type) { described_class::Types::Credit }
128
- it { is_expected.not_to be_debit }
129
- end
130
- end
131
- end
@@ -1,33 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
-
3
- describe Braintree::MerchantAccount do
4
- describe "#inspect" do
5
- it "is a string representation of the merchant account" do
6
- account = Braintree::MerchantAccount._new(nil, :id => "merchant_account", :status => "active", :master_merchant_account => nil)
7
-
8
- expect(account.inspect).to eq("#<Braintree::MerchantAccount: id: \"merchant_account\", status: \"active\", master_merchant_account: nil>")
9
- end
10
-
11
- it "handles a master merchant account" do
12
- account = Braintree::MerchantAccount._new(
13
- nil,
14
- :id => "merchant_account",
15
- :status => "active",
16
- :master_merchant_account => {:id => "master_merchant_account", :status => "active", :master_merchant_account => nil},
17
- )
18
-
19
- master_merchant_account = "#<Braintree::MerchantAccount: id: \"master_merchant_account\", status: \"active\", master_merchant_account: nil>"
20
- expect(account.inspect).to eq("#<Braintree::MerchantAccount: id: \"merchant_account\", status: \"active\", master_merchant_account: #{master_merchant_account}>")
21
- end
22
- end
23
-
24
- describe "default?" do
25
- it "is an alias of default" do
26
- account = Braintree::MerchantAccount._new(nil, :default => false)
27
- expect(account.default?).to eq(false)
28
- account = Braintree::MerchantAccount._new(nil, :default => true)
29
- expect(account.default?).to eq(true)
30
- end
31
- end
32
- end
33
-