braintree 4.13.0 → 4.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) 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/payment_receipt/card_present_data.rb +36 -0
  10. data/lib/braintree/transaction/payment_receipt/merchant_address.rb +19 -0
  11. data/lib/braintree/transaction/payment_receipt.rb +31 -0
  12. data/lib/braintree/transaction/us_bank_account_details.rb +1 -0
  13. data/lib/braintree/transaction.rb +7 -4
  14. data/lib/braintree/transaction_gateway.rb +15 -3
  15. data/lib/braintree/transaction_search.rb +6 -5
  16. data/lib/braintree/version.rb +1 -1
  17. data/lib/braintree/webhook_notification.rb +1 -0
  18. data/lib/braintree/webhook_testing_gateway.rb +17 -0
  19. data/lib/braintree.rb +3 -0
  20. data/spec/integration/braintree/add_on_spec.rb +9 -9
  21. data/spec/integration/braintree/address_spec.rb +69 -69
  22. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  23. data/spec/integration/braintree/apple_pay_spec.rb +8 -8
  24. data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
  25. data/spec/integration/braintree/credit_card_spec.rb +223 -223
  26. data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
  27. data/spec/integration/braintree/credit_card_verification_spec.rb +52 -52
  28. data/spec/integration/braintree/customer_search_spec.rb +20 -20
  29. data/spec/integration/braintree/customer_spec.rb +313 -313
  30. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  31. data/spec/integration/braintree/discount_spec.rb +9 -9
  32. data/spec/integration/braintree/dispute_spec.rb +87 -87
  33. data/spec/integration/braintree/document_upload_spec.rb +17 -17
  34. data/spec/integration/braintree/error_codes_spec.rb +2 -2
  35. data/spec/integration/braintree/http_spec.rb +28 -28
  36. data/spec/integration/braintree/merchant_account_spec.rb +127 -127
  37. data/spec/integration/braintree/merchant_spec.rb +103 -103
  38. data/spec/integration/braintree/oauth_spec.rb +61 -61
  39. data/spec/integration/braintree/payment_method_nonce_spec.rb +73 -73
  40. data/spec/integration/braintree/payment_method_spec.rb +389 -389
  41. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +78 -78
  42. data/spec/integration/braintree/paypal_account_spec.rb +38 -38
  43. data/spec/integration/braintree/plan_spec.rb +15 -15
  44. data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
  45. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
  46. data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
  47. data/spec/integration/braintree/subscription_spec.rb +364 -364
  48. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  49. data/spec/integration/braintree/test_transaction_spec.rb +19 -19
  50. data/spec/integration/braintree/transaction_line_item_spec.rb +6 -6
  51. data/spec/integration/braintree/transaction_search_spec.rb +198 -165
  52. data/spec/integration/braintree/transaction_spec.rb +1319 -1151
  53. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
  54. data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
  55. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
  56. data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
  57. data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
  58. data/spec/spec_helper.rb +9 -8
  59. data/spec/unit/braintree/address_spec.rb +8 -8
  60. data/spec/unit/braintree/base_module_spec.rb +4 -4
  61. data/spec/unit/braintree/client_token_spec.rb +2 -2
  62. data/spec/unit/braintree/configuration_spec.rb +57 -57
  63. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  64. data/spec/unit/braintree/credit_card_spec.rb +31 -29
  65. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +28 -28
  66. data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
  67. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
  68. data/spec/unit/braintree/customer_spec.rb +41 -40
  69. data/spec/unit/braintree/digest_spec.rb +5 -5
  70. data/spec/unit/braintree/disbursement_spec.rb +11 -11
  71. data/spec/unit/braintree/dispute_search_spec.rb +2 -2
  72. data/spec/unit/braintree/dispute_spec.rb +56 -56
  73. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  74. data/spec/unit/braintree/enriched_customer_data_spec.rb +2 -2
  75. data/spec/unit/braintree/error_result_spec.rb +5 -5
  76. data/spec/unit/braintree/errors_spec.rb +9 -9
  77. data/spec/unit/braintree/http_spec.rb +8 -8
  78. data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
  79. data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
  80. data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
  81. data/spec/unit/braintree/merchant_account_spec.rb +4 -4
  82. data/spec/unit/braintree/modification_spec.rb +1 -1
  83. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
  84. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
  85. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
  86. data/spec/unit/braintree/payment_method_spec.rb +19 -19
  87. data/spec/unit/braintree/paypal_account_spec.rb +4 -4
  88. data/spec/unit/braintree/resource_collection_spec.rb +7 -7
  89. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
  90. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  91. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  92. data/spec/unit/braintree/subscription_search_spec.rb +17 -17
  93. data/spec/unit/braintree/subscription_spec.rb +8 -8
  94. data/spec/unit/braintree/successful_result_spec.rb +5 -5
  95. data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
  96. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
  97. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  98. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  99. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
  100. data/spec/unit/braintree/transaction/payment_receipt_spec.rb +73 -0
  101. data/spec/unit/braintree/transaction_gateway_spec.rb +9 -6
  102. data/spec/unit/braintree/transaction_search_spec.rb +2 -2
  103. data/spec/unit/braintree/transaction_spec.rb +101 -93
  104. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  105. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  106. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  107. data/spec/unit/braintree/us_bank_account_verification_spec.rb +7 -7
  108. data/spec/unit/braintree/util_spec.rb +27 -27
  109. data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
  110. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  111. data/spec/unit/braintree/venmo_profile_data_spec.rb +5 -5
  112. data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
  113. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  114. data/spec/unit/braintree/xml/parser_spec.rb +8 -8
  115. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  116. data/spec/unit/braintree/xml_spec.rb +17 -17
  117. data/spec/unit/braintree_spec.rb +2 -2
  118. metadata +7 -2
@@ -15,22 +15,22 @@ describe Braintree::MerchantGateway do
15
15
  :payment_methods => ["credit_card", "paypal"],
16
16
  )
17
17
 
18
- result.should be_success
18
+ expect(result).to be_success
19
19
 
20
20
  merchant = result.merchant
21
- merchant.id.should_not be_nil
22
- merchant.email.should == "name@email.com"
23
- merchant.company_name.should == "name@email.com"
24
- merchant.country_code_alpha3.should == "USA"
25
- merchant.country_code_alpha2.should == "US"
26
- merchant.country_code_numeric.should == "840"
27
- merchant.country_name.should == "United States of America"
21
+ expect(merchant.id).not_to be_nil
22
+ expect(merchant.email).to eq("name@email.com")
23
+ expect(merchant.company_name).to eq("name@email.com")
24
+ expect(merchant.country_code_alpha3).to eq("USA")
25
+ expect(merchant.country_code_alpha2).to eq("US")
26
+ expect(merchant.country_code_numeric).to eq("840")
27
+ expect(merchant.country_name).to eq("United States of America")
28
28
 
29
29
  credentials = result.credentials
30
- credentials.access_token.should_not be_nil
31
- credentials.refresh_token.should_not be_nil
32
- credentials.expires_at.should_not be_nil
33
- credentials.token_type.should == "bearer"
30
+ expect(credentials.access_token).not_to be_nil
31
+ expect(credentials.refresh_token).not_to be_nil
32
+ expect(credentials.expires_at).not_to be_nil
33
+ expect(credentials.token_type).to eq("bearer")
34
34
  end
35
35
 
36
36
  it "gives an error when using invalid payment_methods" do
@@ -46,10 +46,10 @@ describe Braintree::MerchantGateway do
46
46
  :payment_methods => ["fake_money"],
47
47
  )
48
48
 
49
- result.should_not be_success
49
+ expect(result).not_to be_success
50
50
  errors = result.errors.for(:merchant).on(:payment_methods)
51
51
 
52
- errors[0].code.should == Braintree::ErrorCodes::Merchant::PaymentMethodsAreInvalid
52
+ expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::PaymentMethodsAreInvalid)
53
53
  end
54
54
 
55
55
  context "credentials" do
@@ -74,7 +74,7 @@ describe Braintree::MerchantGateway do
74
74
  :payment_methods => ["credit_card", "paypal"],
75
75
  )
76
76
 
77
- result.should be_success
77
+ expect(result).to be_success
78
78
  end
79
79
  end
80
80
 
@@ -96,30 +96,30 @@ describe Braintree::MerchantGateway do
96
96
  )
97
97
 
98
98
  merchant = result.merchant
99
- merchant.id.should_not be_nil
100
- merchant.email.should == "name@email.com"
101
- merchant.company_name.should == "name@email.com"
102
- merchant.country_code_alpha3.should == "USA"
103
- merchant.country_code_alpha2.should == "US"
104
- merchant.country_code_numeric.should == "840"
105
- merchant.country_name.should == "United States of America"
99
+ expect(merchant.id).not_to be_nil
100
+ expect(merchant.email).to eq("name@email.com")
101
+ expect(merchant.company_name).to eq("name@email.com")
102
+ expect(merchant.country_code_alpha3).to eq("USA")
103
+ expect(merchant.country_code_alpha2).to eq("US")
104
+ expect(merchant.country_code_numeric).to eq("840")
105
+ expect(merchant.country_name).to eq("United States of America")
106
106
 
107
107
  credentials = result.credentials
108
- credentials.access_token.should_not be_nil
109
- credentials.refresh_token.should_not be_nil
110
- credentials.expires_at.should_not be_nil
111
- credentials.token_type.should == "bearer"
108
+ expect(credentials.access_token).not_to be_nil
109
+ expect(credentials.refresh_token).not_to be_nil
110
+ expect(credentials.expires_at).not_to be_nil
111
+ expect(credentials.token_type).to eq("bearer")
112
112
 
113
113
  merchant_accounts = merchant.merchant_accounts
114
- merchant_accounts.count.should == 2
114
+ expect(merchant_accounts.count).to eq(2)
115
115
 
116
116
  merchant_account = merchant_accounts.detect { |ma| ma.id == "USD" }
117
- merchant_account.default.should == true
118
- merchant_account.currency_iso_code.should == "USD"
117
+ expect(merchant_account.default).to eq(true)
118
+ expect(merchant_account.currency_iso_code).to eq("USD")
119
119
 
120
120
  merchant_account = merchant_accounts.detect { |ma| ma.id == "GBP" }
121
- merchant_account.default.should == false
122
- merchant_account.currency_iso_code.should == "GBP"
121
+ expect(merchant_account.default).to eq(false)
122
+ expect(merchant_account.currency_iso_code).to eq("GBP")
123
123
  end
124
124
 
125
125
  it "creates an EU multi currency merchant for paypal and credit_card" do
@@ -131,30 +131,30 @@ describe Braintree::MerchantGateway do
131
131
  )
132
132
 
133
133
  merchant = result.merchant
134
- merchant.id.should_not be_nil
135
- merchant.email.should == "name@email.com"
136
- merchant.company_name.should == "name@email.com"
137
- merchant.country_code_alpha3.should == "GBR"
138
- merchant.country_code_alpha2.should == "GB"
139
- merchant.country_code_numeric.should == "826"
140
- merchant.country_name.should == "United Kingdom"
134
+ expect(merchant.id).not_to be_nil
135
+ expect(merchant.email).to eq("name@email.com")
136
+ expect(merchant.company_name).to eq("name@email.com")
137
+ expect(merchant.country_code_alpha3).to eq("GBR")
138
+ expect(merchant.country_code_alpha2).to eq("GB")
139
+ expect(merchant.country_code_numeric).to eq("826")
140
+ expect(merchant.country_name).to eq("United Kingdom")
141
141
 
142
142
  credentials = result.credentials
143
- credentials.access_token.should_not be_nil
144
- credentials.refresh_token.should_not be_nil
145
- credentials.expires_at.should_not be_nil
146
- credentials.token_type.should == "bearer"
143
+ expect(credentials.access_token).not_to be_nil
144
+ expect(credentials.refresh_token).not_to be_nil
145
+ expect(credentials.expires_at).not_to be_nil
146
+ expect(credentials.token_type).to eq("bearer")
147
147
 
148
148
  merchant_accounts = merchant.merchant_accounts
149
- merchant_accounts.count.should == 2
149
+ expect(merchant_accounts.count).to eq(2)
150
150
 
151
151
  merchant_account = merchant_accounts.detect { |ma| ma.id == "GBP" }
152
- merchant_account.default.should == true
153
- merchant_account.currency_iso_code.should == "GBP"
152
+ expect(merchant_account.default).to eq(true)
153
+ expect(merchant_account.currency_iso_code).to eq("GBP")
154
154
 
155
155
  merchant_account = merchant_accounts.detect { |ma| ma.id == "USD" }
156
- merchant_account.default.should == false
157
- merchant_account.currency_iso_code.should == "USD"
156
+ expect(merchant_account.default).to eq(false)
157
+ expect(merchant_account.currency_iso_code).to eq("USD")
158
158
  end
159
159
 
160
160
 
@@ -170,33 +170,33 @@ describe Braintree::MerchantGateway do
170
170
  },
171
171
  )
172
172
 
173
- result.should be_success
173
+ expect(result).to be_success
174
174
 
175
175
  merchant = result.merchant
176
- merchant.id.should_not be_nil
177
- merchant.email.should == "name@email.com"
178
- merchant.company_name.should == "name@email.com"
179
- merchant.country_code_alpha3.should == "USA"
180
- merchant.country_code_alpha2.should == "US"
181
- merchant.country_code_numeric.should == "840"
182
- merchant.country_name.should == "United States of America"
176
+ expect(merchant.id).not_to be_nil
177
+ expect(merchant.email).to eq("name@email.com")
178
+ expect(merchant.company_name).to eq("name@email.com")
179
+ expect(merchant.country_code_alpha3).to eq("USA")
180
+ expect(merchant.country_code_alpha2).to eq("US")
181
+ expect(merchant.country_code_numeric).to eq("840")
182
+ expect(merchant.country_name).to eq("United States of America")
183
183
 
184
184
  credentials = result.credentials
185
- credentials.access_token.should_not be_nil
186
- credentials.refresh_token.should_not be_nil
187
- credentials.expires_at.should_not be_nil
188
- credentials.token_type.should == "bearer"
185
+ expect(credentials.access_token).not_to be_nil
186
+ expect(credentials.refresh_token).not_to be_nil
187
+ expect(credentials.expires_at).not_to be_nil
188
+ expect(credentials.token_type).to eq("bearer")
189
189
 
190
190
  merchant_accounts = merchant.merchant_accounts
191
- merchant_accounts.count.should == 2
191
+ expect(merchant_accounts.count).to eq(2)
192
192
 
193
193
  merchant_account = merchant_accounts.detect { |ma| ma.id == "USD" }
194
- merchant_account.default.should == true
195
- merchant_account.currency_iso_code.should == "USD"
194
+ expect(merchant_account.default).to eq(true)
195
+ expect(merchant_account.currency_iso_code).to eq("USD")
196
196
 
197
197
  merchant_account = merchant_accounts.detect { |ma| ma.id == "GBP" }
198
- merchant_account.default.should == false
199
- merchant_account.currency_iso_code.should == "GBP"
198
+ expect(merchant_account.default).to eq(false)
199
+ expect(merchant_account.currency_iso_code).to eq("GBP")
200
200
  end
201
201
 
202
202
  it "allows creation of non-US merchant if onboarding application is internal" do
@@ -210,29 +210,29 @@ describe Braintree::MerchantGateway do
210
210
  },
211
211
  )
212
212
 
213
- result.should be_success
213
+ expect(result).to be_success
214
214
 
215
215
  merchant = result.merchant
216
- merchant.id.should_not be_nil
217
- merchant.email.should == "name@email.com"
218
- merchant.company_name.should == "name@email.com"
219
- merchant.country_code_alpha3.should == "JPN"
220
- merchant.country_code_alpha2.should == "JP"
221
- merchant.country_code_numeric.should == "392"
222
- merchant.country_name.should == "Japan"
216
+ expect(merchant.id).not_to be_nil
217
+ expect(merchant.email).to eq("name@email.com")
218
+ expect(merchant.company_name).to eq("name@email.com")
219
+ expect(merchant.country_code_alpha3).to eq("JPN")
220
+ expect(merchant.country_code_alpha2).to eq("JP")
221
+ expect(merchant.country_code_numeric).to eq("392")
222
+ expect(merchant.country_name).to eq("Japan")
223
223
 
224
224
  credentials = result.credentials
225
- credentials.access_token.should_not be_nil
226
- credentials.refresh_token.should_not be_nil
227
- credentials.expires_at.should_not be_nil
228
- credentials.token_type.should == "bearer"
225
+ expect(credentials.access_token).not_to be_nil
226
+ expect(credentials.refresh_token).not_to be_nil
227
+ expect(credentials.expires_at).not_to be_nil
228
+ expect(credentials.token_type).to eq("bearer")
229
229
 
230
230
  merchant_accounts = merchant.merchant_accounts
231
- merchant_accounts.count.should == 1
231
+ expect(merchant_accounts.count).to eq(1)
232
232
 
233
233
  merchant_account = merchant_accounts.detect { |ma| ma.id == "JPY" }
234
- merchant_account.default.should == true
235
- merchant_account.currency_iso_code.should == "JPY"
234
+ expect(merchant_account.default).to eq(true)
235
+ expect(merchant_account.currency_iso_code).to eq("JPY")
236
236
  end
237
237
 
238
238
  it "defaults to USD for non-US merchant if onboarding application is internal and country currency not supported" do
@@ -246,29 +246,29 @@ describe Braintree::MerchantGateway do
246
246
  },
247
247
  )
248
248
 
249
- result.should be_success
249
+ expect(result).to be_success
250
250
 
251
251
  merchant = result.merchant
252
- merchant.id.should_not be_nil
253
- merchant.email.should == "name@email.com"
254
- merchant.company_name.should == "name@email.com"
255
- merchant.country_code_alpha3.should == "YEM"
256
- merchant.country_code_alpha2.should == "YE"
257
- merchant.country_code_numeric.should == "887"
258
- merchant.country_name.should == "Yemen"
252
+ expect(merchant.id).not_to be_nil
253
+ expect(merchant.email).to eq("name@email.com")
254
+ expect(merchant.company_name).to eq("name@email.com")
255
+ expect(merchant.country_code_alpha3).to eq("YEM")
256
+ expect(merchant.country_code_alpha2).to eq("YE")
257
+ expect(merchant.country_code_numeric).to eq("887")
258
+ expect(merchant.country_name).to eq("Yemen")
259
259
 
260
260
  credentials = result.credentials
261
- credentials.access_token.should_not be_nil
262
- credentials.refresh_token.should_not be_nil
263
- credentials.expires_at.should_not be_nil
264
- credentials.token_type.should == "bearer"
261
+ expect(credentials.access_token).not_to be_nil
262
+ expect(credentials.refresh_token).not_to be_nil
263
+ expect(credentials.expires_at).not_to be_nil
264
+ expect(credentials.token_type).to eq("bearer")
265
265
 
266
266
  merchant_accounts = merchant.merchant_accounts
267
- merchant_accounts.count.should == 1
267
+ expect(merchant_accounts.count).to eq(1)
268
268
 
269
269
  merchant_account = merchant_accounts.detect { |ma| ma.id == "USD" }
270
- merchant_account.default.should == true
271
- merchant_account.currency_iso_code.should == "USD"
270
+ expect(merchant_account.default).to eq(true)
271
+ expect(merchant_account.currency_iso_code).to eq("USD")
272
272
  end
273
273
 
274
274
  it "returns error if invalid currency is passed" do
@@ -283,10 +283,10 @@ describe Braintree::MerchantGateway do
283
283
  },
284
284
  )
285
285
 
286
- result.should_not be_success
286
+ expect(result).not_to be_success
287
287
  errors = result.errors.for(:merchant).on(:currencies)
288
288
 
289
- errors[0].code.should == Braintree::ErrorCodes::Merchant::CurrenciesAreInvalid
289
+ expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::CurrenciesAreInvalid)
290
290
  end
291
291
  end
292
292
  end
@@ -304,16 +304,16 @@ describe Braintree::MerchantGateway do
304
304
 
305
305
  it "succeeds" do
306
306
  result = Braintree::Merchant.provision_raw_apple_pay
307
- result.should be_success
308
- result.supported_networks.should == ["visa", "mastercard", "amex", "discover", "maestro", "elo"]
307
+ expect(result).to be_success
308
+ expect(result.supported_networks).to eq(["visa", "mastercard", "amex", "discover", "maestro", "elo"])
309
309
  end
310
310
 
311
311
  it "is repeatable" do
312
312
  result = Braintree::Merchant.provision_raw_apple_pay
313
- result.should be_success
313
+ expect(result).to be_success
314
314
  result = Braintree::Merchant.provision_raw_apple_pay
315
- result.should be_success
316
- result.supported_networks.should == ["visa", "mastercard", "amex", "discover", "maestro", "elo"]
315
+ expect(result).to be_success
316
+ expect(result.supported_networks).to eq(["visa", "mastercard", "amex", "discover", "maestro", "elo"])
317
317
  end
318
318
  end
319
319
 
@@ -326,8 +326,8 @@ describe Braintree::MerchantGateway do
326
326
 
327
327
  it "returns a validation error" do
328
328
  result = Braintree::Merchant.provision_raw_apple_pay
329
- result.should_not be_success
330
- result.errors.for(:apple_pay).first.code.should == Braintree::ErrorCodes::ApplePay::ApplePayCardsAreNotAccepted
329
+ expect(result).not_to be_success
330
+ expect(result.errors.for(:apple_pay).first.code).to eq(Braintree::ErrorCodes::ApplePay::ApplePayCardsAreNotAccepted)
331
331
  end
332
332
  end
333
333
 
@@ -21,12 +21,12 @@ describe "OAuth" do
21
21
  :scope => "read_write",
22
22
  )
23
23
 
24
- result.should be_success
24
+ expect(result).to be_success
25
25
  credentials = result.credentials
26
- credentials.access_token.should_not be_nil
27
- credentials.refresh_token.should_not be_nil
28
- credentials.expires_at.should_not be_nil
29
- credentials.token_type.should == "bearer"
26
+ expect(credentials.access_token).not_to be_nil
27
+ expect(credentials.refresh_token).not_to be_nil
28
+ expect(credentials.expires_at).not_to be_nil
29
+ expect(credentials.token_type).to eq("bearer")
30
30
  end
31
31
 
32
32
  it "returns validation errors for bad params" do
@@ -35,9 +35,9 @@ describe "OAuth" do
35
35
  :scope => "read_write",
36
36
  )
37
37
 
38
- result.should_not be_success
39
- errors = result.errors.for(:credentials).on(:code)[0].code.should == Braintree::ErrorCodes::OAuth::InvalidGrant
40
- result.message.should =~ /Invalid grant: code not found/
38
+ expect(result).not_to be_success
39
+ errors = expect(result.errors.for(:credentials).on(:code)[0].code).to eq(Braintree::ErrorCodes::OAuth::InvalidGrant)
40
+ expect(result.message).to match(/Invalid grant: code not found/)
41
41
  end
42
42
 
43
43
  it "raises with a helpful error if client_id and client_secret are not set" do
@@ -71,12 +71,12 @@ describe "OAuth" do
71
71
  :scope => "read_write",
72
72
  )
73
73
 
74
- result.should be_success
74
+ expect(result).to be_success
75
75
  credentials = result.credentials
76
- credentials.access_token.should_not be_nil
77
- credentials.refresh_token.should_not be_nil
78
- credentials.expires_at.should_not be_nil
79
- credentials.token_type.should == "bearer"
76
+ expect(credentials.access_token).not_to be_nil
77
+ expect(credentials.refresh_token).not_to be_nil
78
+ expect(credentials.expires_at).not_to be_nil
79
+ expect(credentials.token_type).to eq("bearer")
80
80
  end
81
81
  end
82
82
 
@@ -92,7 +92,7 @@ describe "OAuth" do
92
92
  ).credentials.access_token
93
93
 
94
94
  result = @gateway.oauth.revoke_access_token(access_token)
95
- result.should be_success
95
+ expect(result).to be_success
96
96
 
97
97
  gateway = Braintree::Gateway.new(
98
98
  :access_token => access_token,
@@ -150,49 +150,49 @@ describe "OAuth" do
150
150
  )
151
151
 
152
152
  uri = URI.parse(url)
153
- uri.host.should == Braintree::Configuration.instantiate.server
154
- uri.path.should == "/oauth/connect"
153
+ expect(uri.host).to eq(Braintree::Configuration.instantiate.server)
154
+ expect(uri.path).to eq("/oauth/connect")
155
155
 
156
156
  query = CGI.parse(uri.query)
157
- query["merchant_id"].should == ["integration_merchant_id"]
158
- query["client_id"].should == ["client_id$#{Braintree::Configuration.environment}$integration_client_id"]
159
- query["redirect_uri"].should == ["http://bar.example.com"]
160
- query["scope"].should == ["read_write"]
161
- query["state"].should == ["baz_state"]
162
- query["landing_page"].should == ["signup"]
163
- query["login_only"].should == ["false"]
164
-
165
- query["user[country]"].should == ["USA"]
166
- query["business[name]"].should == ["14 Ladders"]
167
-
168
- query["user[email]"].should == ["foo@example.com"]
169
- query["user[first_name]"].should == ["Bob"]
170
- query["user[last_name]"].should == ["Jones"]
171
- query["user[phone]"].should == ["555-555-5555"]
172
- query["user[dob_year]"].should == ["1970"]
173
- query["user[dob_month]"].should == ["01"]
174
- query["user[dob_day]"].should == ["01"]
175
- query["user[street_address]"].should == ["222 W Merchandise Mart"]
176
- query["user[locality]"].should == ["Chicago"]
177
- query["user[region]"].should == ["IL"]
178
- query["user[postal_code]"].should == ["60606"]
179
-
180
- query["business[name]"].should == ["14 Ladders"]
181
- query["business[registered_as]"].should == ["14.0 Ladders"]
182
- query["business[industry]"].should == ["Ladders"]
183
- query["business[description]"].should == ["We sell the best ladders"]
184
- query["business[street_address]"].should == ["111 N Canal"]
185
- query["business[locality]"].should == ["Chicago"]
186
- query["business[region]"].should == ["IL"]
187
- query["business[postal_code]"].should == ["60606"]
188
- query["business[country]"].should == ["USA"]
189
- query["business[annual_volume_amount]"].should == ["1000000"]
190
- query["business[average_transaction_amount]"].should == ["100"]
191
- query["business[maximum_transaction_amount]"].should == ["10000"]
192
- query["business[ship_physical_goods]"].should == ["true"]
193
- query["business[fulfillment_completed_in]"].should == ["7"]
194
- query["business[currency]"].should == ["USD"]
195
- query["business[website]"].should == ["http://example.com"]
157
+ expect(query["merchant_id"]).to eq(["integration_merchant_id"])
158
+ expect(query["client_id"]).to eq(["client_id$#{Braintree::Configuration.environment}$integration_client_id"])
159
+ expect(query["redirect_uri"]).to eq(["http://bar.example.com"])
160
+ expect(query["scope"]).to eq(["read_write"])
161
+ expect(query["state"]).to eq(["baz_state"])
162
+ expect(query["landing_page"]).to eq(["signup"])
163
+ expect(query["login_only"]).to eq(["false"])
164
+
165
+ expect(query["user[country]"]).to eq(["USA"])
166
+ expect(query["business[name]"]).to eq(["14 Ladders"])
167
+
168
+ expect(query["user[email]"]).to eq(["foo@example.com"])
169
+ expect(query["user[first_name]"]).to eq(["Bob"])
170
+ expect(query["user[last_name]"]).to eq(["Jones"])
171
+ expect(query["user[phone]"]).to eq(["555-555-5555"])
172
+ expect(query["user[dob_year]"]).to eq(["1970"])
173
+ expect(query["user[dob_month]"]).to eq(["01"])
174
+ expect(query["user[dob_day]"]).to eq(["01"])
175
+ expect(query["user[street_address]"]).to eq(["222 W Merchandise Mart"])
176
+ expect(query["user[locality]"]).to eq(["Chicago"])
177
+ expect(query["user[region]"]).to eq(["IL"])
178
+ expect(query["user[postal_code]"]).to eq(["60606"])
179
+
180
+ expect(query["business[name]"]).to eq(["14 Ladders"])
181
+ expect(query["business[registered_as]"]).to eq(["14.0 Ladders"])
182
+ expect(query["business[industry]"]).to eq(["Ladders"])
183
+ expect(query["business[description]"]).to eq(["We sell the best ladders"])
184
+ expect(query["business[street_address]"]).to eq(["111 N Canal"])
185
+ expect(query["business[locality]"]).to eq(["Chicago"])
186
+ expect(query["business[region]"]).to eq(["IL"])
187
+ expect(query["business[postal_code]"]).to eq(["60606"])
188
+ expect(query["business[country]"]).to eq(["USA"])
189
+ expect(query["business[annual_volume_amount]"]).to eq(["1000000"])
190
+ expect(query["business[average_transaction_amount]"]).to eq(["100"])
191
+ expect(query["business[maximum_transaction_amount]"]).to eq(["10000"])
192
+ expect(query["business[ship_physical_goods]"]).to eq(["true"])
193
+ expect(query["business[fulfillment_completed_in]"]).to eq(["7"])
194
+ expect(query["business[currency]"]).to eq(["USD"])
195
+ expect(query["business[website]"]).to eq(["http://example.com"])
196
196
  end
197
197
 
198
198
  it "builds the query string with multiple payment_methods" do
@@ -205,13 +205,13 @@ describe "OAuth" do
205
205
  )
206
206
 
207
207
  uri = URI.parse(url)
208
- uri.host.should == Braintree::Configuration.instantiate.server
209
- uri.path.should == "/oauth/connect"
208
+ expect(uri.host).to eq(Braintree::Configuration.instantiate.server)
209
+ expect(uri.path).to eq("/oauth/connect")
210
210
 
211
211
  query = CGI.parse(CGI.unescape(uri.query))
212
- query["payment_methods[]"].length.should == 2
213
- query["payment_methods[]"].should include("paypal")
214
- query["payment_methods[]"].should include("credit_card")
212
+ expect(query["payment_methods[]"].length).to eq(2)
213
+ expect(query["payment_methods[]"]).to include("paypal")
214
+ expect(query["payment_methods[]"]).to include("credit_card")
215
215
  end
216
216
 
217
217
  it "doesn't mutate the options" do
@@ -219,7 +219,7 @@ describe "OAuth" do
219
219
 
220
220
  @gateway.oauth.connect_url(params)
221
221
 
222
- params.should == {:payment_methods => ["credit_card"]}
222
+ expect(params).to eq({:payment_methods => ["credit_card"]})
223
223
  end
224
224
  end
225
225
  end