braintree 4.14.0 → 4.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/credit_card.rb +13 -0
  3. data/lib/braintree/credit_card_gateway.rb +15 -3
  4. data/lib/braintree/payment_method_gateway.rb +15 -3
  5. data/lib/braintree/test/nonce.rb +1 -0
  6. data/lib/braintree/test/venmo_sdk.rb +2 -0
  7. data/lib/braintree/transaction/credit_card_details.rb +3 -0
  8. data/lib/braintree/transaction/local_payment_details.rb +2 -0
  9. data/lib/braintree/transaction.rb +5 -4
  10. data/lib/braintree/transaction_gateway.rb +15 -3
  11. data/lib/braintree/transaction_search.rb +6 -5
  12. data/lib/braintree/version.rb +1 -1
  13. data/lib/braintree/webhook_notification.rb +1 -0
  14. data/lib/braintree/webhook_testing_gateway.rb +17 -0
  15. data/spec/integration/braintree/add_on_spec.rb +9 -9
  16. data/spec/integration/braintree/address_spec.rb +69 -69
  17. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  18. data/spec/integration/braintree/apple_pay_spec.rb +8 -8
  19. data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
  20. data/spec/integration/braintree/credit_card_spec.rb +223 -223
  21. data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
  22. data/spec/integration/braintree/credit_card_verification_spec.rb +52 -52
  23. data/spec/integration/braintree/customer_search_spec.rb +20 -20
  24. data/spec/integration/braintree/customer_spec.rb +313 -313
  25. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  26. data/spec/integration/braintree/discount_spec.rb +9 -9
  27. data/spec/integration/braintree/dispute_spec.rb +87 -87
  28. data/spec/integration/braintree/document_upload_spec.rb +17 -17
  29. data/spec/integration/braintree/error_codes_spec.rb +2 -2
  30. data/spec/integration/braintree/http_spec.rb +28 -28
  31. data/spec/integration/braintree/merchant_account_spec.rb +127 -127
  32. data/spec/integration/braintree/merchant_spec.rb +103 -103
  33. data/spec/integration/braintree/oauth_spec.rb +61 -61
  34. data/spec/integration/braintree/payment_method_nonce_spec.rb +73 -73
  35. data/spec/integration/braintree/payment_method_spec.rb +389 -389
  36. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +78 -78
  37. data/spec/integration/braintree/paypal_account_spec.rb +38 -38
  38. data/spec/integration/braintree/plan_spec.rb +15 -15
  39. data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
  40. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
  41. data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
  42. data/spec/integration/braintree/subscription_spec.rb +364 -364
  43. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  44. data/spec/integration/braintree/test_transaction_spec.rb +19 -19
  45. data/spec/integration/braintree/transaction_line_item_spec.rb +6 -6
  46. data/spec/integration/braintree/transaction_search_spec.rb +198 -165
  47. data/spec/integration/braintree/transaction_spec.rb +1315 -1149
  48. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
  49. data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
  50. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
  51. data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
  52. data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
  53. data/spec/spec_helper.rb +9 -8
  54. data/spec/unit/braintree/address_spec.rb +8 -8
  55. data/spec/unit/braintree/base_module_spec.rb +4 -4
  56. data/spec/unit/braintree/client_token_spec.rb +2 -2
  57. data/spec/unit/braintree/configuration_spec.rb +57 -57
  58. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  59. data/spec/unit/braintree/credit_card_spec.rb +31 -29
  60. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +28 -28
  61. data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
  62. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
  63. data/spec/unit/braintree/customer_spec.rb +41 -40
  64. data/spec/unit/braintree/digest_spec.rb +5 -5
  65. data/spec/unit/braintree/disbursement_spec.rb +11 -11
  66. data/spec/unit/braintree/dispute_search_spec.rb +2 -2
  67. data/spec/unit/braintree/dispute_spec.rb +56 -56
  68. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  69. data/spec/unit/braintree/enriched_customer_data_spec.rb +2 -2
  70. data/spec/unit/braintree/error_result_spec.rb +5 -5
  71. data/spec/unit/braintree/errors_spec.rb +9 -9
  72. data/spec/unit/braintree/http_spec.rb +8 -8
  73. data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
  74. data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
  75. data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
  76. data/spec/unit/braintree/merchant_account_spec.rb +4 -4
  77. data/spec/unit/braintree/modification_spec.rb +1 -1
  78. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
  79. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
  80. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
  81. data/spec/unit/braintree/payment_method_spec.rb +19 -19
  82. data/spec/unit/braintree/paypal_account_spec.rb +4 -4
  83. data/spec/unit/braintree/resource_collection_spec.rb +7 -7
  84. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
  85. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  86. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  87. data/spec/unit/braintree/subscription_search_spec.rb +17 -17
  88. data/spec/unit/braintree/subscription_spec.rb +8 -8
  89. data/spec/unit/braintree/successful_result_spec.rb +5 -5
  90. data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
  91. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
  92. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  93. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  94. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
  95. data/spec/unit/braintree/transaction_gateway_spec.rb +9 -6
  96. data/spec/unit/braintree/transaction_search_spec.rb +2 -2
  97. data/spec/unit/braintree/transaction_spec.rb +101 -93
  98. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  99. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  100. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  101. data/spec/unit/braintree/us_bank_account_verification_spec.rb +7 -7
  102. data/spec/unit/braintree/util_spec.rb +27 -27
  103. data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
  104. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  105. data/spec/unit/braintree/venmo_profile_data_spec.rb +5 -5
  106. data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
  107. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  108. data/spec/unit/braintree/xml/parser_spec.rb +8 -8
  109. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  110. data/spec/unit/braintree/xml_spec.rb +17 -17
  111. data/spec/unit/braintree_spec.rb +2 -2
  112. metadata +3 -2
@@ -25,8 +25,8 @@ describe Braintree::Transaction do
25
25
  :submit_for_settlement => true,
26
26
  },
27
27
  )
28
- result.success?.should == false
29
- result.errors.for(:transaction).on(:payment_method_nonce)[0].code.should == Braintree::ErrorCodes::Transaction::UsBankAccountNonceMustBePlaidVerified
28
+ expect(result.success?).to eq(false)
29
+ expect(result.errors.for(:transaction).on(:payment_method_nonce)[0].code).to eq(Braintree::ErrorCodes::Transaction::UsBankAccountNonceMustBePlaidVerified)
30
30
  end
31
31
 
32
32
  it "sale fails for invalid nonce" do
@@ -39,8 +39,8 @@ describe Braintree::Transaction do
39
39
  :submit_for_settlement => true,
40
40
  },
41
41
  )
42
- result.success?.should == false
43
- result.errors.for(:transaction).on(:payment_method_nonce)[0].code.should == Braintree::ErrorCodes::Transaction::PaymentMethodNonceUnknown
42
+ expect(result.success?).to eq(false)
43
+ expect(result.errors.for(:transaction).on(:payment_method_nonce)[0].code).to eq(Braintree::ErrorCodes::Transaction::PaymentMethodNonceUnknown)
44
44
  end
45
45
  end
46
46
 
@@ -56,12 +56,12 @@ describe Braintree::Transaction do
56
56
  )
57
57
  payment_method = result.payment_method
58
58
 
59
- payment_method.verifications.count.should == 1
59
+ expect(payment_method.verifications.count).to eq(1)
60
60
  payment_method.verifications.first.status == Braintree::UsBankAccountVerification::Status::Verified
61
61
  payment_method.verifications.first.verification_method == Braintree::UsBankAccountVerification::VerificationMethod::IndependentCheck
62
- payment_method.verifications.first.id.should_not be_empty
63
- payment_method.verifications.first.verification_determined_at.should be_a Time
64
- payment_method.verified.should == true
62
+ expect(payment_method.verifications.first.id).not_to be_empty
63
+ expect(payment_method.verifications.first.verification_determined_at).to be_a Time
64
+ expect(payment_method.verified).to eq(true)
65
65
 
66
66
  result = Braintree::Transaction.create(
67
67
  :type => "sale",
@@ -73,7 +73,7 @@ describe Braintree::Transaction do
73
73
  },
74
74
  )
75
75
 
76
- result.success?.should == true
76
+ expect(result.success?).to eq(true)
77
77
  end
78
78
 
79
79
  it "sale fails for unverified token" do
@@ -85,8 +85,8 @@ describe Braintree::Transaction do
85
85
  },
86
86
  ).payment_method
87
87
 
88
- payment_method.verifications.count.should == 0
89
- payment_method.verified.should == false
88
+ expect(payment_method.verifications.count).to eq(0)
89
+ expect(payment_method.verified).to eq(false)
90
90
 
91
91
  result = Braintree::Transaction.create(
92
92
  :type => "sale",
@@ -98,8 +98,8 @@ describe Braintree::Transaction do
98
98
  },
99
99
  )
100
100
 
101
- result.success?.should == false
102
- result.errors.for(:transaction)[0].code.should == Braintree::ErrorCodes::Transaction::UsBankAccountNotVerified
101
+ expect(result.success?).to eq(false)
102
+ expect(result.errors.for(:transaction)[0].code).to eq(Braintree::ErrorCodes::Transaction::UsBankAccountNotVerified)
103
103
  end
104
104
  end
105
105
  end
@@ -127,21 +127,21 @@ describe Braintree::Transaction do
127
127
  :submit_for_settlement => true,
128
128
  },
129
129
  )
130
- result.success?.should == true
130
+ expect(result.success?).to eq(true)
131
131
 
132
132
  transaction = result.transaction
133
133
 
134
- transaction.id.should =~ /^\w{6,}$/
135
- transaction.type.should == "sale"
136
- transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
137
- transaction.status.should == Braintree::Transaction::Status::SettlementPending
138
- transaction.us_bank_account_details.routing_number.should == "021000021"
139
- transaction.us_bank_account_details.last_4.should == "0000"
140
- transaction.us_bank_account_details.account_type.should == "checking"
141
- transaction.us_bank_account_details.account_holder_name.should == "John Doe"
142
- transaction.us_bank_account_details.bank_name.should =~ /CHASE/
143
- transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
144
- transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
134
+ expect(transaction.id).to match(/^\w{6,}$/)
135
+ expect(transaction.type).to eq("sale")
136
+ expect(transaction.amount).to eq(BigDecimal(Braintree::Test::TransactionAmounts::Authorize))
137
+ expect(transaction.status).to eq(Braintree::Transaction::Status::SettlementPending)
138
+ expect(transaction.us_bank_account_details.routing_number).to eq("021000021")
139
+ expect(transaction.us_bank_account_details.last_4).to eq("0000")
140
+ expect(transaction.us_bank_account_details.account_type).to eq("checking")
141
+ expect(transaction.us_bank_account_details.account_holder_name).to eq("John Doe")
142
+ expect(transaction.us_bank_account_details.bank_name).to match(/CHASE/)
143
+ expect(transaction.us_bank_account_details.ach_mandate.text).to eq("cl mandate text")
144
+ expect(transaction.us_bank_account_details.ach_mandate.accepted_at).to be_a Time
145
145
  end
146
146
 
147
147
  it "sale fails for invalid nonce" do
@@ -154,8 +154,8 @@ describe Braintree::Transaction do
154
154
  :submit_for_settlement => true,
155
155
  },
156
156
  )
157
- result.success?.should == false
158
- result.errors.for(:transaction).on(:payment_method_nonce)[0].code.should == Braintree::ErrorCodes::Transaction::PaymentMethodNonceUnknown
157
+ expect(result.success?).to eq(false)
158
+ expect(result.errors.for(:transaction).on(:payment_method_nonce)[0].code).to eq(Braintree::ErrorCodes::Transaction::PaymentMethodNonceUnknown)
159
159
  end
160
160
  end
161
161
 
@@ -170,12 +170,12 @@ describe Braintree::Transaction do
170
170
  )
171
171
  payment_method = result.payment_method
172
172
 
173
- payment_method.verifications.count.should == 1
173
+ expect(payment_method.verifications.count).to eq(1)
174
174
  payment_method.verifications.first.status == Braintree::UsBankAccountVerification::Status::Verified
175
175
  payment_method.verifications.first.verification_method == Braintree::UsBankAccountVerification::VerificationMethod::IndependentCheck
176
- payment_method.verifications.first.id.should_not be_empty
177
- payment_method.verifications.first.verification_determined_at.should be_a Time
178
- payment_method.verified.should == true
176
+ expect(payment_method.verifications.first.id).not_to be_empty
177
+ expect(payment_method.verifications.first.verification_determined_at).to be_a Time
178
+ expect(payment_method.verified).to eq(true)
179
179
 
180
180
  result = Braintree::Transaction.create(
181
181
  :type => "sale",
@@ -187,7 +187,7 @@ describe Braintree::Transaction do
187
187
  },
188
188
  )
189
189
 
190
- result.success?.should == true
190
+ expect(result.success?).to eq(true)
191
191
  end
192
192
  end
193
193
  end
@@ -14,17 +14,17 @@ describe Braintree::UsBankAccount do
14
14
  :verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
15
15
  },
16
16
  )
17
- result.should be_success
17
+ expect(result).to be_success
18
18
 
19
19
  us_bank_account = Braintree::UsBankAccount.find(result.payment_method.token)
20
- us_bank_account.should be_a(Braintree::UsBankAccount)
21
- us_bank_account.routing_number.should == "021000021"
22
- us_bank_account.last_4.should == "0000"
23
- us_bank_account.account_type.should == "checking"
24
- us_bank_account.account_holder_name.should == "John Doe"
25
- us_bank_account.bank_name.should =~ /CHASE/
26
- us_bank_account.ach_mandate.text.should == "cl mandate text"
27
- us_bank_account.ach_mandate.accepted_at.should be_a Time
20
+ expect(us_bank_account).to be_a(Braintree::UsBankAccount)
21
+ expect(us_bank_account.routing_number).to eq("021000021")
22
+ expect(us_bank_account.last_4).to eq("0000")
23
+ expect(us_bank_account.account_type).to eq("checking")
24
+ expect(us_bank_account.account_holder_name).to eq("John Doe")
25
+ expect(us_bank_account.bank_name).to match(/CHASE/)
26
+ expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
27
+ expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
28
28
  end
29
29
 
30
30
  it "raises if the payment method token is not found" do
@@ -46,7 +46,7 @@ describe Braintree::UsBankAccount do
46
46
  :verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
47
47
  },
48
48
  )
49
- result.should be_success
49
+ expect(result).to be_success
50
50
 
51
51
  result = Braintree::UsBankAccount.sale(
52
52
  result.payment_method.token,
@@ -54,17 +54,17 @@ describe Braintree::UsBankAccount do
54
54
  :amount => "100.00",
55
55
  )
56
56
 
57
- result.success?.should == true
58
- result.transaction.amount.should == BigDecimal("100.00")
59
- result.transaction.type.should == "sale"
57
+ expect(result.success?).to eq(true)
58
+ expect(result.transaction.amount).to eq(BigDecimal("100.00"))
59
+ expect(result.transaction.type).to eq("sale")
60
60
  us_bank_account = result.transaction.us_bank_account_details
61
- us_bank_account.routing_number.should == "021000021"
62
- us_bank_account.last_4.should == "0000"
63
- us_bank_account.account_type.should == "checking"
64
- us_bank_account.account_holder_name.should == "John Doe"
65
- us_bank_account.bank_name.should =~ /CHASE/
66
- us_bank_account.ach_mandate.text.should == "cl mandate text"
67
- us_bank_account.ach_mandate.accepted_at.should be_a Time
61
+ expect(us_bank_account.routing_number).to eq("021000021")
62
+ expect(us_bank_account.last_4).to eq("0000")
63
+ expect(us_bank_account.account_type).to eq("checking")
64
+ expect(us_bank_account.account_holder_name).to eq("John Doe")
65
+ expect(us_bank_account.bank_name).to match(/CHASE/)
66
+ expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
67
+ expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
68
68
  end
69
69
  end
70
70
 
@@ -80,7 +80,7 @@ describe Braintree::UsBankAccount do
80
80
  :verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
81
81
  },
82
82
  )
83
- result.should be_success
83
+ expect(result).to be_success
84
84
 
85
85
  transaction = Braintree::UsBankAccount.sale!(
86
86
  result.payment_method.token,
@@ -88,16 +88,16 @@ describe Braintree::UsBankAccount do
88
88
  :amount => "100.00",
89
89
  )
90
90
 
91
- transaction.amount.should == BigDecimal("100.00")
92
- transaction.type.should == "sale"
91
+ expect(transaction.amount).to eq(BigDecimal("100.00"))
92
+ expect(transaction.type).to eq("sale")
93
93
  us_bank_account = transaction.us_bank_account_details
94
- us_bank_account.routing_number.should == "021000021"
95
- us_bank_account.last_4.should == "0000"
96
- us_bank_account.account_type.should == "checking"
97
- us_bank_account.account_holder_name.should == "John Doe"
98
- us_bank_account.bank_name.should =~ /CHASE/
99
- us_bank_account.ach_mandate.text.should == "cl mandate text"
100
- us_bank_account.ach_mandate.accepted_at.should be_a Time
94
+ expect(us_bank_account.routing_number).to eq("021000021")
95
+ expect(us_bank_account.last_4).to eq("0000")
96
+ expect(us_bank_account.account_type).to eq("checking")
97
+ expect(us_bank_account.account_holder_name).to eq("John Doe")
98
+ expect(us_bank_account.bank_name).to match(/CHASE/)
99
+ expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
100
+ expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
101
101
  end
102
102
 
103
103
  it "does not creates a transaction using a us bank account and returns raises an exception" do
@@ -7,7 +7,7 @@ describe Braintree::UsBankAccountVerification, "search" do
7
7
  search.account_holder_name.is "thisnameisnotreal"
8
8
  end
9
9
 
10
- collection.maximum_size.should == 0
10
+ expect(collection.maximum_size).to eq(0)
11
11
  end
12
12
 
13
13
  let(:nonce) { generate_non_plaid_us_bank_account_nonce }
@@ -40,14 +40,14 @@ describe Braintree::UsBankAccountVerification, "search" do
40
40
  search.id.is verification.id
41
41
  search.send(criterion).is value
42
42
  end
43
- collection.maximum_size.should == 1
44
- collection.first.id.should == verification.id
43
+ expect(collection.maximum_size).to eq(1)
44
+ expect(collection.first.id).to eq(verification.id)
45
45
 
46
46
  collection = Braintree::UsBankAccountVerification.search do |search|
47
47
  search.id.is verification.id
48
48
  search.send(criterion).is "invalid_attribute"
49
49
  end
50
- collection.should be_empty
50
+ expect(collection).to be_empty
51
51
  end
52
52
 
53
53
  collection = Braintree::UsBankAccountVerification.search do |search|
@@ -57,8 +57,8 @@ describe Braintree::UsBankAccountVerification, "search" do
57
57
  end
58
58
  end
59
59
 
60
- collection.maximum_size.should == 1
61
- collection.first.id.should == verification.id
60
+ expect(collection.maximum_size).to eq(1)
61
+ expect(collection.first.id).to eq(verification.id)
62
62
  end
63
63
 
64
64
  describe "multiple value fields" do
@@ -87,7 +87,7 @@ describe Braintree::UsBankAccountVerification, "search" do
87
87
  search.ids.in verification1.id, verification2.id
88
88
  end
89
89
 
90
- collection.maximum_size.should == 2
90
+ expect(collection.maximum_size).to eq(2)
91
91
  end
92
92
  end
93
93
 
@@ -114,24 +114,24 @@ describe Braintree::UsBankAccountVerification, "search" do
114
114
  )
115
115
  end
116
116
 
117
- collection.maximum_size.should == 1
118
- collection.first.id.should == verification.id
117
+ expect(collection.maximum_size).to eq(1)
118
+ expect(collection.first.id).to eq(verification.id)
119
119
 
120
120
  collection = Braintree::UsBankAccountVerification.search do |search|
121
121
  search.id.is verification.id
122
122
  search.created_at >= created_at - 1
123
123
  end
124
124
 
125
- collection.maximum_size.should == 1
126
- collection.first.id.should == verification.id
125
+ expect(collection.maximum_size).to eq(1)
126
+ expect(collection.first.id).to eq(verification.id)
127
127
 
128
128
  collection = Braintree::UsBankAccountVerification.search do |search|
129
129
  search.id.is verification.id
130
130
  search.created_at <= created_at + 1
131
131
  end
132
132
 
133
- collection.maximum_size.should == 1
134
- collection.first.id.should == verification.id
133
+ expect(collection.maximum_size).to eq(1)
134
+ expect(collection.first.id).to eq(verification.id)
135
135
 
136
136
  collection = Braintree::UsBankAccountVerification.search do |search|
137
137
  search.id.is verification.id
@@ -141,15 +141,15 @@ describe Braintree::UsBankAccountVerification, "search" do
141
141
  )
142
142
  end
143
143
 
144
- collection.maximum_size.should == 0
144
+ expect(collection.maximum_size).to eq(0)
145
145
 
146
146
  collection = Braintree::UsBankAccountVerification.search do |search|
147
147
  search.id.is verification.id
148
148
  search.created_at.is created_at
149
149
  end
150
150
 
151
- collection.maximum_size.should == 1
152
- collection.first.id.should == verification.id
151
+ expect(collection.maximum_size).to eq(1)
152
+ expect(collection.first.id).to eq(verification.id)
153
153
  end
154
154
  end
155
155
 
@@ -171,8 +171,8 @@ describe Braintree::UsBankAccountVerification, "search" do
171
171
  search.account_number.ends_with "0000"
172
172
  end
173
173
 
174
- collection.maximum_size.should == 1
175
- collection.first.id.should == verification.id
174
+ expect(collection.maximum_size).to eq(1)
175
+ expect(collection.first.id).to eq(verification.id)
176
176
  end
177
177
  end
178
178
  end
@@ -39,20 +39,20 @@ describe Braintree::UsBankAccountVerification do
39
39
  },
40
40
  )
41
41
 
42
- result.should be_success
42
+ expect(result).to be_success
43
43
 
44
44
  verification = result.payment_method.verifications.first
45
- verification.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::MicroTransfers
46
- verification.status.should == Braintree::UsBankAccountVerification::Status::Pending
45
+ expect(verification.verification_method).to eq(Braintree::UsBankAccountVerification::VerificationMethod::MicroTransfers)
46
+ expect(verification.status).to eq(Braintree::UsBankAccountVerification::Status::Pending)
47
47
 
48
48
  response = Braintree::UsBankAccountVerification.confirm_micro_transfer_amounts(verification.id, [17, 29])
49
49
 
50
- response.should be_success
51
- response.us_bank_account_verification.status.should == Braintree::UsBankAccountVerification::Status::Verified
50
+ expect(response).to be_success
51
+ expect(response.us_bank_account_verification.status).to eq(Braintree::UsBankAccountVerification::Status::Verified)
52
52
 
53
53
  us_bank_account = Braintree::UsBankAccount.find(response.us_bank_account_verification.us_bank_account[:token])
54
54
 
55
- us_bank_account.verified.should be_truthy
55
+ expect(us_bank_account.verified).to be_truthy
56
56
  end
57
57
 
58
58
  it "successfully confirms not-yet-settled amounts" do
@@ -67,16 +67,16 @@ describe Braintree::UsBankAccountVerification do
67
67
  },
68
68
  )
69
69
 
70
- result.should be_success
70
+ expect(result).to be_success
71
71
 
72
72
  verification = result.payment_method.verifications.first
73
- verification.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::MicroTransfers
74
- verification.status.should == Braintree::UsBankAccountVerification::Status::Pending
73
+ expect(verification.verification_method).to eq(Braintree::UsBankAccountVerification::VerificationMethod::MicroTransfers)
74
+ expect(verification.status).to eq(Braintree::UsBankAccountVerification::Status::Pending)
75
75
 
76
76
  response = Braintree::UsBankAccountVerification.confirm_micro_transfer_amounts(verification.id, [17, 29])
77
77
 
78
- response.should be_success
79
- response.us_bank_account_verification.status.should == Braintree::UsBankAccountVerification::Status::Pending
78
+ expect(response).to be_success
79
+ expect(response.us_bank_account_verification.status).to eq(Braintree::UsBankAccountVerification::Status::Pending)
80
80
  end
81
81
 
82
82
  it "attempts to confirm" do
@@ -89,16 +89,16 @@ describe Braintree::UsBankAccountVerification do
89
89
  },
90
90
  )
91
91
 
92
- result.should be_success
92
+ expect(result).to be_success
93
93
 
94
94
  verification = result.payment_method.verifications.first
95
- verification.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::MicroTransfers
96
- verification.status.should == Braintree::UsBankAccountVerification::Status::Pending
95
+ expect(verification.verification_method).to eq(Braintree::UsBankAccountVerification::VerificationMethod::MicroTransfers)
96
+ expect(verification.status).to eq(Braintree::UsBankAccountVerification::Status::Pending)
97
97
 
98
98
  response = Braintree::UsBankAccountVerification.confirm_micro_transfer_amounts(verification.id, [1, 1])
99
99
 
100
- response.should_not be_success
101
- response.errors.for(:us_bank_account_verification)[0].code.should == Braintree::ErrorCodes::UsBankAccountVerification::AmountsDoNotMatch
100
+ expect(response).not_to be_success
101
+ expect(response.errors.for(:us_bank_account_verification)[0].code).to eq(Braintree::ErrorCodes::UsBankAccountVerification::AmountsDoNotMatch)
102
102
  end
103
103
 
104
104
  it "exceeds the confirmation attempt threshold" do
@@ -111,7 +111,7 @@ describe Braintree::UsBankAccountVerification do
111
111
  },
112
112
  )
113
113
 
114
- result.should be_success
114
+ expect(result).to be_success
115
115
 
116
116
  verification = result.payment_method.verifications.first
117
117
 
@@ -119,17 +119,17 @@ describe Braintree::UsBankAccountVerification do
119
119
  4.times do
120
120
  response = Braintree::UsBankAccountVerification.confirm_micro_transfer_amounts(verification.id, [1, 1])
121
121
 
122
- response.should_not be_success
123
- response.errors.for(:us_bank_account_verification)[0].code.should == Braintree::ErrorCodes::UsBankAccountVerification::AmountsDoNotMatch
122
+ expect(response).not_to be_success
123
+ expect(response.errors.for(:us_bank_account_verification)[0].code).to eq(Braintree::ErrorCodes::UsBankAccountVerification::AmountsDoNotMatch)
124
124
  end
125
125
 
126
126
  response = Braintree::UsBankAccountVerification.confirm_micro_transfer_amounts(verification.id, [1, 1])
127
- response.should_not be_success
128
- response.errors.for(:us_bank_account_verification)[0].code.should == Braintree::ErrorCodes::UsBankAccountVerification::TooManyConfirmationAttempts
127
+ expect(response).not_to be_success
128
+ expect(response.errors.for(:us_bank_account_verification)[0].code).to eq(Braintree::ErrorCodes::UsBankAccountVerification::TooManyConfirmationAttempts)
129
129
 
130
130
  response = Braintree::UsBankAccountVerification.confirm_micro_transfer_amounts(verification.id, [1, 1])
131
- response.should_not be_success
132
- response.errors.for(:us_bank_account_verification)[0].code.should == Braintree::ErrorCodes::UsBankAccountVerification::TooManyConfirmationAttempts
131
+ expect(response).not_to be_success
132
+ expect(response.errors.for(:us_bank_account_verification)[0].code).to eq(Braintree::ErrorCodes::UsBankAccountVerification::TooManyConfirmationAttempts)
133
133
  end
134
134
 
135
135
  it "returns an error for invalid deposit amounts" do
@@ -142,13 +142,13 @@ describe Braintree::UsBankAccountVerification do
142
142
  },
143
143
  )
144
144
 
145
- result.should be_success
145
+ expect(result).to be_success
146
146
 
147
147
  verification = result.payment_method.verifications.first
148
148
  response = Braintree::UsBankAccountVerification.confirm_micro_transfer_amounts(verification.id, ["abc"])
149
149
 
150
- response.should_not be_success
151
- response.errors.for(:us_bank_account_verification)[0].code.should == Braintree::ErrorCodes::UsBankAccountVerification::InvalidDepositAmounts
150
+ expect(response).not_to be_success
151
+ expect(response.errors.for(:us_bank_account_verification)[0].code).to eq(Braintree::ErrorCodes::UsBankAccountVerification::InvalidDepositAmounts)
152
152
  end
153
153
  end
154
154
 
@@ -163,13 +163,13 @@ describe Braintree::UsBankAccountVerification do
163
163
  },
164
164
  )
165
165
 
166
- result.should be_success
166
+ expect(result).to be_success
167
167
 
168
168
  verification = result.payment_method.verifications.first
169
169
  response = Braintree::UsBankAccountVerification.confirm_micro_transfer_amounts(verification.id, [1, 1])
170
170
 
171
- response.should_not be_success
172
- response.errors.for(:us_bank_account_verification)[0].code.should == Braintree::ErrorCodes::UsBankAccountVerification::MustBeMicroTransfersVerification
171
+ expect(response).not_to be_success
172
+ expect(response.errors.for(:us_bank_account_verification)[0].code).to eq(Braintree::ErrorCodes::UsBankAccountVerification::MustBeMicroTransfersVerification)
173
173
  end
174
174
  end
175
175
  end
@@ -185,12 +185,12 @@ describe Braintree::UsBankAccountVerification do
185
185
  },
186
186
  )
187
187
 
188
- result.should be_success
188
+ expect(result).to be_success
189
189
 
190
190
  created_verification = result.payment_method.verifications.first
191
191
  found_verification = Braintree::UsBankAccountVerification.find(created_verification.id)
192
192
 
193
- found_verification.should == created_verification
193
+ expect(found_verification).to eq(created_verification)
194
194
  end
195
195
 
196
196
  it "raises a NotFoundError exception if verification cannot be found" do
@@ -224,7 +224,7 @@ describe Braintree::UsBankAccountVerification do
224
224
  search.verification_method.in created_verification.verification_method
225
225
  end
226
226
 
227
- found_verifications.should include(created_verification)
227
+ expect(found_verifications).to include(created_verification)
228
228
  end
229
229
 
230
230
  it "searches and finds verifications using customer fields" do
@@ -234,7 +234,7 @@ describe Braintree::UsBankAccountVerification do
234
234
  search.payment_method_token.is payment_method.token
235
235
  end
236
236
 
237
- found_verifications.count.should eq(1)
237
+ expect(found_verifications.count).to eq(1)
238
238
  end
239
239
  end
240
240
  end