braintree 4.14.0 → 4.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (247) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/account_updater_daily_report.rb +3 -3
  3. data/lib/braintree/ach_mandate.rb +1 -1
  4. data/lib/braintree/add_on_gateway.rb +1 -1
  5. data/lib/braintree/address.rb +4 -4
  6. data/lib/braintree/address_gateway.rb +5 -5
  7. data/lib/braintree/advanced_search.rb +10 -10
  8. data/lib/braintree/apple_pay.rb +3 -3
  9. data/lib/braintree/apple_pay_card.rb +3 -3
  10. data/lib/braintree/apple_pay_options.rb +3 -3
  11. data/lib/braintree/authorization_adjustment.rb +3 -3
  12. data/lib/braintree/base_module.rb +1 -1
  13. data/lib/braintree/bin_data.rb +2 -2
  14. data/lib/braintree/client_token_gateway.rb +1 -1
  15. data/lib/braintree/configuration.rb +22 -22
  16. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  17. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  18. data/lib/braintree/credit_card.rb +22 -9
  19. data/lib/braintree/credit_card_gateway.rb +23 -11
  20. data/lib/braintree/credit_card_verification.rb +3 -3
  21. data/lib/braintree/credit_card_verification_gateway.rb +28 -11
  22. data/lib/braintree/credit_card_verification_search.rb +1 -1
  23. data/lib/braintree/customer.rb +5 -9
  24. data/lib/braintree/customer_gateway.rb +7 -7
  25. data/lib/braintree/customer_search.rb +1 -1
  26. data/lib/braintree/descriptor.rb +1 -1
  27. data/lib/braintree/digest.rb +1 -1
  28. data/lib/braintree/disbursement.rb +5 -5
  29. data/lib/braintree/discount_gateway.rb +1 -1
  30. data/lib/braintree/dispute/evidence.rb +1 -1
  31. data/lib/braintree/dispute/paypal_message.rb +1 -1
  32. data/lib/braintree/dispute/status_history.rb +1 -1
  33. data/lib/braintree/dispute/transaction.rb +1 -1
  34. data/lib/braintree/dispute/transaction_details.rb +1 -1
  35. data/lib/braintree/dispute.rb +3 -3
  36. data/lib/braintree/dispute_gateway.rb +1 -1
  37. data/lib/braintree/dispute_search.rb +1 -1
  38. data/lib/braintree/document_upload.rb +2 -2
  39. data/lib/braintree/document_upload_gateway.rb +3 -3
  40. data/lib/braintree/enriched_customer_data.rb +2 -2
  41. data/lib/braintree/error_codes.rb +4 -0
  42. data/lib/braintree/error_result.rb +2 -3
  43. data/lib/braintree/errors.rb +3 -3
  44. data/lib/braintree/exceptions.rb +1 -2
  45. data/lib/braintree/exchange_rate.rb +2 -2
  46. data/lib/braintree/exchange_rate_quote.rb +3 -3
  47. data/lib/braintree/exchange_rate_quote_gateway.rb +1 -1
  48. data/lib/braintree/exchange_rate_quote_input.rb +3 -3
  49. data/lib/braintree/exchange_rate_quote_request.rb +3 -3
  50. data/lib/braintree/exchange_rate_quote_response.rb +3 -3
  51. data/lib/braintree/facilitated_details.rb +1 -1
  52. data/lib/braintree/facilitator_details.rb +1 -1
  53. data/lib/braintree/google_pay_card.rb +3 -3
  54. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  55. data/lib/braintree/graphql_client.rb +1 -1
  56. data/lib/braintree/http.rb +5 -5
  57. data/lib/braintree/local_payment_completed.rb +2 -2
  58. data/lib/braintree/local_payment_expired.rb +2 -2
  59. data/lib/braintree/local_payment_funded.rb +2 -2
  60. data/lib/braintree/local_payment_reversed.rb +2 -2
  61. data/lib/braintree/merchant.rb +3 -3
  62. data/lib/braintree/merchant_account.rb +2 -2
  63. data/lib/braintree/merchant_account_gateway.rb +9 -9
  64. data/lib/braintree/meta_checkout_card.rb +89 -0
  65. data/lib/braintree/meta_checkout_token.rb +88 -0
  66. data/lib/braintree/modification.rb +3 -3
  67. data/lib/braintree/oauth_credentials.rb +3 -3
  68. data/lib/braintree/paginated_collection.rb +2 -2
  69. data/lib/braintree/paginated_result.rb +1 -1
  70. data/lib/braintree/payment_instrument_type.rb +2 -0
  71. data/lib/braintree/payment_method_customer_data_updated_metadata.rb +2 -2
  72. data/lib/braintree/payment_method_gateway.rb +23 -10
  73. data/lib/braintree/payment_method_nonce.rb +4 -4
  74. data/lib/braintree/payment_method_nonce_details.rb +1 -1
  75. data/lib/braintree/payment_method_nonce_details_payer_info.rb +1 -1
  76. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  77. data/lib/braintree/paypal_account.rb +1 -2
  78. data/lib/braintree/paypal_account_gateway.rb +5 -5
  79. data/lib/braintree/plan.rb +1 -1
  80. data/lib/braintree/plan_gateway.rb +2 -2
  81. data/lib/braintree/resource_collection.rb +2 -2
  82. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  83. data/lib/braintree/risk_data.rb +1 -1
  84. data/lib/braintree/samsung_pay_card.rb +5 -5
  85. data/lib/braintree/sepa_direct_debit_account.rb +2 -2
  86. data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +1 -1
  87. data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
  88. data/lib/braintree/sha256_digest.rb +1 -1
  89. data/lib/braintree/subscription/status_details.rb +1 -1
  90. data/lib/braintree/subscription.rb +2 -2
  91. data/lib/braintree/subscription_gateway.rb +6 -6
  92. data/lib/braintree/subscription_search.rb +1 -1
  93. data/lib/braintree/successful_result.rb +2 -2
  94. data/lib/braintree/test/credit_card.rb +7 -10
  95. data/lib/braintree/test/merchant_account.rb +1 -1
  96. data/lib/braintree/test/nonce.rb +4 -0
  97. data/lib/braintree/test/transaction_amounts.rb +2 -3
  98. data/lib/braintree/test/venmo_sdk.rb +2 -0
  99. data/lib/braintree/testing_gateway.rb +1 -1
  100. data/lib/braintree/three_d_secure_info.rb +1 -1
  101. data/lib/braintree/transaction/address_details.rb +2 -1
  102. data/lib/braintree/transaction/credit_card_details.rb +4 -1
  103. data/lib/braintree/transaction/customer_details.rb +1 -1
  104. data/lib/braintree/transaction/disbursement_details.rb +1 -1
  105. data/lib/braintree/transaction/local_payment_details.rb +2 -0
  106. data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
  107. data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
  108. data/lib/braintree/transaction/package_details.rb +16 -0
  109. data/lib/braintree/transaction/samsung_pay_card_details.rb +1 -1
  110. data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +1 -1
  111. data/lib/braintree/transaction/status_details.rb +1 -1
  112. data/lib/braintree/transaction/subscription_details.rb +1 -1
  113. data/lib/braintree/transaction/us_bank_account_details.rb +1 -1
  114. data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
  115. data/lib/braintree/transaction.rb +37 -20
  116. data/lib/braintree/transaction_gateway.rb +44 -15
  117. data/lib/braintree/transaction_line_item.rb +13 -10
  118. data/lib/braintree/transaction_line_item_gateway.rb +1 -1
  119. data/lib/braintree/transaction_review.rb +1 -1
  120. data/lib/braintree/transaction_search.rb +7 -6
  121. data/lib/braintree/unknown_payment_method.rb +1 -1
  122. data/lib/braintree/us_bank_account.rb +2 -2
  123. data/lib/braintree/us_bank_account_verification.rb +23 -15
  124. data/lib/braintree/us_bank_account_verification_search.rb +1 -1
  125. data/lib/braintree/util.rb +3 -3
  126. data/lib/braintree/validation_error.rb +1 -1
  127. data/lib/braintree/validation_error_collection.rb +3 -3
  128. data/lib/braintree/venmo_account.rb +3 -3
  129. data/lib/braintree/venmo_profile_data.rb +6 -4
  130. data/lib/braintree/version.rb +1 -1
  131. data/lib/braintree/visa_checkout_card.rb +7 -7
  132. data/lib/braintree/webhook_notification.rb +3 -2
  133. data/lib/braintree/webhook_notification_gateway.rb +4 -4
  134. data/lib/braintree/webhook_testing.rb +1 -1
  135. data/lib/braintree/webhook_testing_gateway.rb +18 -1
  136. data/lib/braintree/xml/generator.rb +1 -1
  137. data/lib/braintree/xml/libxml.rb +1 -1
  138. data/lib/braintree/xml/parser.rb +3 -3
  139. data/lib/braintree/xml/rexml.rb +2 -2
  140. data/lib/braintree/xml.rb +1 -1
  141. data/lib/braintree.rb +5 -1
  142. data/spec/integration/braintree/add_on_spec.rb +9 -9
  143. data/spec/integration/braintree/address_spec.rb +69 -69
  144. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  145. data/spec/integration/braintree/apple_pay_spec.rb +8 -8
  146. data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
  147. data/spec/integration/braintree/client_api/spec_helper.rb +2 -2
  148. data/spec/integration/braintree/credit_card_spec.rb +227 -228
  149. data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
  150. data/spec/integration/braintree/credit_card_verification_spec.rb +98 -53
  151. data/spec/integration/braintree/customer_search_spec.rb +20 -20
  152. data/spec/integration/braintree/customer_spec.rb +317 -317
  153. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  154. data/spec/integration/braintree/discount_spec.rb +9 -9
  155. data/spec/integration/braintree/dispute_search_spec.rb +0 -1
  156. data/spec/integration/braintree/dispute_spec.rb +87 -87
  157. data/spec/integration/braintree/document_upload_spec.rb +17 -17
  158. data/spec/integration/braintree/error_codes_spec.rb +2 -2
  159. data/spec/integration/braintree/http_spec.rb +28 -28
  160. data/spec/integration/braintree/merchant_account_spec.rb +127 -127
  161. data/spec/integration/braintree/merchant_spec.rb +103 -103
  162. data/spec/integration/braintree/oauth_spec.rb +61 -61
  163. data/spec/integration/braintree/package_tracking_spec.rb +111 -0
  164. data/spec/integration/braintree/payment_method_nonce_spec.rb +89 -69
  165. data/spec/integration/braintree/payment_method_spec.rb +391 -391
  166. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +150 -78
  167. data/spec/integration/braintree/paypal_account_spec.rb +38 -38
  168. data/spec/integration/braintree/plan_spec.rb +15 -15
  169. data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
  170. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
  171. data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
  172. data/spec/integration/braintree/subscription_spec.rb +364 -364
  173. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  174. data/spec/integration/braintree/test_transaction_spec.rb +19 -19
  175. data/spec/integration/braintree/transaction_line_item_spec.rb +12 -6
  176. data/spec/integration/braintree/transaction_search_spec.rb +225 -165
  177. data/spec/integration/braintree/transaction_spec.rb +1606 -1230
  178. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
  179. data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
  180. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
  181. data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
  182. data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
  183. data/spec/spec_helper.rb +9 -8
  184. data/spec/unit/braintree/address_spec.rb +8 -8
  185. data/spec/unit/braintree/base_module_spec.rb +4 -4
  186. data/spec/unit/braintree/client_token_spec.rb +2 -2
  187. data/spec/unit/braintree/configuration_spec.rb +57 -57
  188. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  189. data/spec/unit/braintree/credit_card_spec.rb +31 -29
  190. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +33 -28
  191. data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
  192. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
  193. data/spec/unit/braintree/customer_spec.rb +41 -40
  194. data/spec/unit/braintree/digest_spec.rb +5 -5
  195. data/spec/unit/braintree/disbursement_spec.rb +11 -11
  196. data/spec/unit/braintree/dispute_search_spec.rb +2 -2
  197. data/spec/unit/braintree/dispute_spec.rb +56 -56
  198. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  199. data/spec/unit/braintree/enriched_customer_data_spec.rb +11 -2
  200. data/spec/unit/braintree/error_result_spec.rb +5 -5
  201. data/spec/unit/braintree/errors_spec.rb +9 -9
  202. data/spec/unit/braintree/http_spec.rb +9 -9
  203. data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
  204. data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
  205. data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
  206. data/spec/unit/braintree/merchant_account_spec.rb +4 -4
  207. data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
  208. data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
  209. data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
  210. data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
  211. data/spec/unit/braintree/modification_spec.rb +1 -1
  212. data/spec/unit/braintree/package_tracking_spec.rb +74 -0
  213. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
  214. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
  215. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
  216. data/spec/unit/braintree/payment_method_spec.rb +19 -19
  217. data/spec/unit/braintree/paypal_account_spec.rb +4 -4
  218. data/spec/unit/braintree/resource_collection_spec.rb +7 -7
  219. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
  220. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  221. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  222. data/spec/unit/braintree/subscription_search_spec.rb +17 -17
  223. data/spec/unit/braintree/subscription_spec.rb +8 -8
  224. data/spec/unit/braintree/successful_result_spec.rb +5 -5
  225. data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
  226. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
  227. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  228. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  229. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
  230. data/spec/unit/braintree/transaction_gateway_spec.rb +41 -9
  231. data/spec/unit/braintree/transaction_search_spec.rb +2 -2
  232. data/spec/unit/braintree/transaction_spec.rb +101 -93
  233. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  234. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  235. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  236. data/spec/unit/braintree/us_bank_account_verification_spec.rb +12 -7
  237. data/spec/unit/braintree/util_spec.rb +27 -27
  238. data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
  239. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  240. data/spec/unit/braintree/venmo_profile_data_spec.rb +16 -5
  241. data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
  242. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  243. data/spec/unit/braintree/xml/parser_spec.rb +8 -8
  244. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  245. data/spec/unit/braintree/xml_spec.rb +17 -17
  246. data/spec/unit/braintree_spec.rb +2 -2
  247. metadata +14 -2
@@ -6,10 +6,10 @@ describe Braintree::Customer do
6
6
  describe "self.all" do
7
7
  it "gets more than a page of customers" do
8
8
  customers = Braintree::Customer.all
9
- customers.maximum_size.should > 100
9
+ expect(customers.maximum_size).to be > 100
10
10
 
11
11
  customer_ids = customers.map { |c| c.id }.uniq.compact
12
- customer_ids.size.should == customers.maximum_size
12
+ expect(customer_ids.size).to eq(customers.maximum_size)
13
13
  end
14
14
  end
15
15
 
@@ -19,11 +19,11 @@ describe Braintree::Customer do
19
19
  :first_name => "Joe",
20
20
  :last_name => "Cool",
21
21
  )
22
- create_result.success?.should == true
22
+ expect(create_result.success?).to eq(true)
23
23
  customer = create_result.customer
24
24
 
25
25
  delete_result = Braintree::Customer.delete(customer.id)
26
- delete_result.success?.should == true
26
+ expect(delete_result.success?).to eq(true)
27
27
  expect do
28
28
  Braintree::Customer.find(customer.id)
29
29
  end.to raise_error(Braintree::NotFoundError)
@@ -42,17 +42,17 @@ describe Braintree::Customer do
42
42
  :website => "www.microsoft.com",
43
43
  :tax_identifiers => [{:country_code => "US", :identifier => "987654321"}],
44
44
  )
45
- result.success?.should == true
46
- result.customer.id.should =~ /^\d{6,}$/
47
- result.customer.first_name.should == "Bill"
48
- result.customer.last_name.should == "Gates"
49
- result.customer.company.should == "Microsoft"
50
- result.customer.email.should == "bill@microsoft.com"
51
- result.customer.phone.should == "312.555.1234"
52
- result.customer.fax.should == "614.555.5678"
53
- result.customer.website.should == "www.microsoft.com"
54
- result.customer.created_at.between?(Time.now - 10, Time.now).should == true
55
- result.customer.updated_at.between?(Time.now - 10, Time.now).should == true
45
+ expect(result.success?).to eq(true)
46
+ expect(result.customer.id).to match(/^\d{6,}$/)
47
+ expect(result.customer.first_name).to eq("Bill")
48
+ expect(result.customer.last_name).to eq("Gates")
49
+ expect(result.customer.company).to eq("Microsoft")
50
+ expect(result.customer.email).to eq("bill@microsoft.com")
51
+ expect(result.customer.phone).to eq("312.555.1234")
52
+ expect(result.customer.fax).to eq("614.555.5678")
53
+ expect(result.customer.website).to eq("www.microsoft.com")
54
+ expect(result.customer.created_at.between?(Time.now - 10, Time.now)).to eq(true)
55
+ expect(result.customer.updated_at.between?(Time.now - 10, Time.now)).to eq(true)
56
56
  end
57
57
 
58
58
  it "returns a successful result if successful using an access token" do
@@ -80,10 +80,10 @@ describe Braintree::Customer do
80
80
  :fax => "614.555.5678",
81
81
  :website => "www.example.com",
82
82
  )
83
- result.success?.should == true
84
- result.customer.id.should =~ /^\d{6,}$/
85
- result.customer.first_name.should == "Joe"
86
- result.customer.last_name.should == "Brown"
83
+ expect(result.success?).to eq(true)
84
+ expect(result.customer.id).to match(/^\d{6,}$/)
85
+ expect(result.customer.first_name).to eq("Joe")
86
+ expect(result.customer.last_name).to eq("Brown")
87
87
  end
88
88
 
89
89
  it "supports creation with device_data" do
@@ -96,7 +96,7 @@ describe Braintree::Customer do
96
96
  },
97
97
  )
98
98
 
99
- result.should be_success
99
+ expect(result).to be_success
100
100
  end
101
101
 
102
102
  it "supports creation including risk data with customer_browser and customer_ip" do
@@ -112,7 +112,7 @@ describe Braintree::Customer do
112
112
  },
113
113
  )
114
114
 
115
- result.should be_success
115
+ expect(result).to be_success
116
116
  end
117
117
 
118
118
  it "includes risk data when skip_advanced_fraud_checking is false" do
@@ -163,38 +163,38 @@ describe Braintree::Customer do
163
163
  ],
164
164
  )
165
165
 
166
- result.should be_success
166
+ expect(result).to be_success
167
167
  end
168
168
 
169
169
  it "can create without any attributes" do
170
170
  result = Braintree::Customer.create
171
- result.success?.should == true
171
+ expect(result.success?).to eq(true)
172
172
  end
173
173
 
174
174
  it "supports utf-8" do
175
175
  first_name = "Jos\303\251"
176
176
  last_name = "Mu\303\261oz"
177
177
  result = Braintree::Customer.create(:first_name => first_name, :last_name => last_name)
178
- result.success?.should == true
178
+ expect(result.success?).to eq(true)
179
179
 
180
180
  if RUBY_VERSION =~ /^1.8/
181
- result.customer.first_name.should == first_name
182
- result.customer.last_name.should == last_name
181
+ expect(result.customer.first_name).to eq(first_name)
182
+ expect(result.customer.last_name).to eq(last_name)
183
183
 
184
184
  found_customer = Braintree::Customer.find(result.customer.id)
185
- found_customer.first_name.should == first_name
186
- found_customer.last_name.should == last_name
185
+ expect(found_customer.first_name).to eq(first_name)
186
+ expect(found_customer.last_name).to eq(last_name)
187
187
  else
188
- result.customer.first_name.should == "José"
189
- result.customer.first_name.bytes.map { |b| b.to_s(8) }.should == ["112", "157", "163", "303", "251"]
190
- result.customer.last_name.should == "Muñoz"
191
- result.customer.last_name.bytes.map { |b| b.to_s(8) }.should == ["115", "165", "303", "261", "157", "172"]
188
+ expect(result.customer.first_name).to eq("José")
189
+ expect(result.customer.first_name.bytes.map { |b| b.to_s(8) }).to eq(["112", "157", "163", "303", "251"])
190
+ expect(result.customer.last_name).to eq("Muñoz")
191
+ expect(result.customer.last_name.bytes.map { |b| b.to_s(8) }).to eq(["115", "165", "303", "261", "157", "172"])
192
192
 
193
193
  found_customer = Braintree::Customer.find(result.customer.id)
194
- found_customer.first_name.should == "José"
195
- found_customer.first_name.bytes.map { |b| b.to_s(8) }.should == ["112", "157", "163", "303", "251"]
196
- found_customer.last_name.should == "Muñoz"
197
- found_customer.last_name.bytes.map { |b| b.to_s(8) }.should == ["115", "165", "303", "261", "157", "172"]
194
+ expect(found_customer.first_name).to eq("José")
195
+ expect(found_customer.first_name.bytes.map { |b| b.to_s(8) }).to eq(["112", "157", "163", "303", "251"])
196
+ expect(found_customer.last_name).to eq("Muñoz")
197
+ expect(found_customer.last_name.bytes.map { |b| b.to_s(8) }).to eq(["115", "165", "303", "261", "157", "172"])
198
198
  end
199
199
  end
200
200
 
@@ -202,8 +202,8 @@ describe Braintree::Customer do
202
202
  result = Braintree::Customer.create(
203
203
  :email => "@invalid.com",
204
204
  )
205
- result.success?.should == false
206
- result.errors.for(:customer).on(:email)[0].message.should == "Email is an invalid format."
205
+ expect(result.success?).to eq(false)
206
+ expect(result.errors.for(:customer).on(:email)[0].message).to eq("Email is an invalid format.")
207
207
  end
208
208
 
209
209
  it "can create a customer and a payment method at the same time" do
@@ -217,13 +217,13 @@ describe Braintree::Customer do
217
217
  },
218
218
  )
219
219
 
220
- result.success?.should == true
221
- result.customer.first_name.should == "Mike"
222
- result.customer.last_name.should == "Jones"
223
- result.customer.credit_cards[0].bin.should == Braintree::Test::CreditCardNumbers::MasterCard[0, 6]
224
- result.customer.credit_cards[0].last_4.should == Braintree::Test::CreditCardNumbers::MasterCard[-4..-1]
225
- result.customer.credit_cards[0].expiration_date.should == "05/2010"
226
- result.customer.credit_cards[0].unique_number_identifier.should =~ /\A\w{32}\z/
220
+ expect(result.success?).to eq(true)
221
+ expect(result.customer.first_name).to eq("Mike")
222
+ expect(result.customer.last_name).to eq("Jones")
223
+ expect(result.customer.credit_cards[0].bin).to eq(Braintree::Test::CreditCardNumbers::MasterCard[0, 6])
224
+ expect(result.customer.credit_cards[0].last_4).to eq(Braintree::Test::CreditCardNumbers::MasterCard[-4..-1])
225
+ expect(result.customer.credit_cards[0].expiration_date).to eq("05/2010")
226
+ expect(result.customer.credit_cards[0].unique_number_identifier).to match(/\A\w{32}\z/)
227
227
  end
228
228
 
229
229
  it "can create a customer and a paypal account at the same time" do
@@ -237,11 +237,11 @@ describe Braintree::Customer do
237
237
  },
238
238
  )
239
239
 
240
- result.success?.should == true
241
- result.customer.first_name.should == "Mike"
242
- result.customer.last_name.should == "Jones"
243
- result.customer.paypal_accounts[0].billing_agreement_id.should == "B-123456"
244
- result.customer.paypal_accounts[0].email.should == "other@example.com"
240
+ expect(result.success?).to eq(true)
241
+ expect(result.customer.first_name).to eq("Mike")
242
+ expect(result.customer.last_name).to eq("Jones")
243
+ expect(result.customer.paypal_accounts[0].billing_agreement_id).to eq("B-123456")
244
+ expect(result.customer.paypal_accounts[0].email).to eq("other@example.com")
245
245
  end
246
246
 
247
247
  it "verifies the card if credit_card[options][verify_card]=true" do
@@ -254,8 +254,8 @@ describe Braintree::Customer do
254
254
  :options => {:verify_card => true}
255
255
  },
256
256
  )
257
- result.success?.should == false
258
- result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
257
+ expect(result.success?).to eq(false)
258
+ expect(result.credit_card_verification.status).to eq(Braintree::Transaction::Status::ProcessorDeclined)
259
259
  end
260
260
 
261
261
  it "allows a verification_amount" do
@@ -268,7 +268,7 @@ describe Braintree::Customer do
268
268
  :options => {:verify_card => true, :verification_amount => "2.00"}
269
269
  },
270
270
  )
271
- result.success?.should == true
271
+ expect(result.success?).to eq(true)
272
272
  end
273
273
 
274
274
  it "fails on create if credit_card[options][fail_on_duplicate_payment_method]=true and there is a duplicated payment method" do
@@ -288,8 +288,8 @@ describe Braintree::Customer do
288
288
  :options => {:fail_on_duplicate_payment_method => true}
289
289
  },
290
290
  )
291
- result.success?.should == false
292
- result.errors.for(:customer).for(:credit_card).on(:number)[0].message.should == "Duplicate card exists in the vault."
291
+ expect(result.success?).to eq(false)
292
+ expect(result.errors.for(:customer).for(:credit_card).on(:number)[0].message).to eq("Duplicate card exists in the vault.")
293
293
  end
294
294
 
295
295
  it "allows the user to specify the merchant account for verification" do
@@ -305,8 +305,8 @@ describe Braintree::Customer do
305
305
  }
306
306
  },
307
307
  )
308
- result.success?.should == false
309
- result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
308
+ expect(result.success?).to eq(false)
309
+ expect(result.credit_card_verification.status).to eq(Braintree::Transaction::Status::ProcessorDeclined)
310
310
  end
311
311
 
312
312
  it "can create a customer and a payment method at the same time after validating verification_currency_iso_code" do
@@ -324,13 +324,13 @@ describe Braintree::Customer do
324
324
  },
325
325
  )
326
326
 
327
- result.success?.should == true
328
- result.customer.first_name.should == "Mike"
329
- result.customer.last_name.should == "Jones"
330
- result.customer.credit_cards[0].bin.should == Braintree::Test::CreditCardNumbers::MasterCard[0, 6]
331
- result.customer.credit_cards[0].last_4.should == Braintree::Test::CreditCardNumbers::MasterCard[-4..-1]
332
- result.customer.credit_cards[0].expiration_date.should == "05/2010"
333
- result.customer.credit_cards[0].unique_number_identifier.should =~ /\A\w{32}\z/
327
+ expect(result.success?).to eq(true)
328
+ expect(result.customer.first_name).to eq("Mike")
329
+ expect(result.customer.last_name).to eq("Jones")
330
+ expect(result.customer.credit_cards[0].bin).to eq(Braintree::Test::CreditCardNumbers::MasterCard[0, 6])
331
+ expect(result.customer.credit_cards[0].last_4).to eq(Braintree::Test::CreditCardNumbers::MasterCard[-4..-1])
332
+ expect(result.customer.credit_cards[0].expiration_date).to eq("05/2010")
333
+ expect(result.customer.credit_cards[0].unique_number_identifier).to match(/\A\w{32}\z/)
334
334
  result.customer.credit_cards[0].verification.currency_iso_code == "USD"
335
335
  end
336
336
 
@@ -366,14 +366,14 @@ describe Braintree::Customer do
366
366
  }
367
367
  },
368
368
  )
369
- result.success?.should == true
369
+ expect(result.success?).to eq(true)
370
370
  result.customer.credit_cards[0].verification.currency_iso_code == "USD"
371
- result.customer.first_name.should == "Mike"
372
- result.customer.last_name.should == "Jones"
373
- result.customer.credit_cards[0].bin.should == Braintree::Test::CreditCardNumbers::MasterCard[0, 6]
374
- result.customer.credit_cards[0].last_4.should == Braintree::Test::CreditCardNumbers::MasterCard[-4..-1]
375
- result.customer.credit_cards[0].expiration_date.should == "05/2010"
376
- result.customer.credit_cards[0].unique_number_identifier.should =~ /\A\w{32}\z/
371
+ expect(result.customer.first_name).to eq("Mike")
372
+ expect(result.customer.last_name).to eq("Jones")
373
+ expect(result.customer.credit_cards[0].bin).to eq(Braintree::Test::CreditCardNumbers::MasterCard[0, 6])
374
+ expect(result.customer.credit_cards[0].last_4).to eq(Braintree::Test::CreditCardNumbers::MasterCard[-4..-1])
375
+ expect(result.customer.credit_cards[0].expiration_date).to eq("05/2010")
376
+ expect(result.customer.credit_cards[0].unique_number_identifier).to match(/\A\w{32}\z/)
377
377
  end
378
378
 
379
379
  it "validates verification_currency_iso_code of the given verification_merchant_account_id and returns error" do
@@ -412,20 +412,20 @@ describe Braintree::Customer do
412
412
  }
413
413
  },
414
414
  )
415
- result.success?.should == true
416
- result.customer.first_name.should == "Mike"
417
- result.customer.last_name.should == "Jones"
418
- result.customer.credit_cards[0].bin.should == Braintree::Test::CreditCardNumbers::MasterCard[0, 6]
419
- result.customer.credit_cards[0].last_4.should == Braintree::Test::CreditCardNumbers::MasterCard[-4..-1]
420
- result.customer.credit_cards[0].expiration_date.should == "05/2010"
421
- result.customer.credit_cards[0].billing_address.id.should == result.customer.addresses[0].id
422
- result.customer.addresses[0].id.should =~ /\w+/
423
- result.customer.addresses[0].street_address.should == "1 E Main St"
424
- result.customer.addresses[0].extended_address.should == "Suite 3"
425
- result.customer.addresses[0].locality.should == "Chicago"
426
- result.customer.addresses[0].region.should == "Illinois"
427
- result.customer.addresses[0].postal_code.should == "60622"
428
- result.customer.addresses[0].country_name.should == "United States of America"
415
+ expect(result.success?).to eq(true)
416
+ expect(result.customer.first_name).to eq("Mike")
417
+ expect(result.customer.last_name).to eq("Jones")
418
+ expect(result.customer.credit_cards[0].bin).to eq(Braintree::Test::CreditCardNumbers::MasterCard[0, 6])
419
+ expect(result.customer.credit_cards[0].last_4).to eq(Braintree::Test::CreditCardNumbers::MasterCard[-4..-1])
420
+ expect(result.customer.credit_cards[0].expiration_date).to eq("05/2010")
421
+ expect(result.customer.credit_cards[0].billing_address.id).to eq(result.customer.addresses[0].id)
422
+ expect(result.customer.addresses[0].id).to match(/\w+/)
423
+ expect(result.customer.addresses[0].street_address).to eq("1 E Main St")
424
+ expect(result.customer.addresses[0].extended_address).to eq("Suite 3")
425
+ expect(result.customer.addresses[0].locality).to eq("Chicago")
426
+ expect(result.customer.addresses[0].region).to eq("Illinois")
427
+ expect(result.customer.addresses[0].postal_code).to eq("60622")
428
+ expect(result.customer.addresses[0].country_name).to eq("United States of America")
429
429
  end
430
430
 
431
431
  it "can use any country code" do
@@ -443,11 +443,11 @@ describe Braintree::Customer do
443
443
  }
444
444
  },
445
445
  )
446
- result.success?.should == true
447
- result.customer.addresses[0].country_name.should == "Comoros"
448
- result.customer.addresses[0].country_code_alpha2.should == "KM"
449
- result.customer.addresses[0].country_code_alpha3.should == "COM"
450
- result.customer.addresses[0].country_code_numeric.should == "174"
446
+ expect(result.success?).to eq(true)
447
+ expect(result.customer.addresses[0].country_name).to eq("Comoros")
448
+ expect(result.customer.addresses[0].country_code_alpha2).to eq("KM")
449
+ expect(result.customer.addresses[0].country_code_alpha3).to eq("COM")
450
+ expect(result.customer.addresses[0].country_code_numeric).to eq("174")
451
451
  end
452
452
 
453
453
  it "stores custom fields when valid" do
@@ -458,8 +458,8 @@ describe Braintree::Customer do
458
458
  :store_me => "custom value"
459
459
  },
460
460
  )
461
- result.success?.should == true
462
- result.customer.custom_fields[:store_me].should == "custom value"
461
+ expect(result.success?).to eq(true)
462
+ expect(result.customer.custom_fields[:store_me]).to eq("custom value")
463
463
  end
464
464
 
465
465
  it "returns empty hash for custom fields when blank" do
@@ -468,8 +468,8 @@ describe Braintree::Customer do
468
468
  :last_name => "Gates",
469
469
  :custom_fields => {:store_me => ""},
470
470
  )
471
- result.success?.should == true
472
- result.customer.custom_fields.should == {}
471
+ expect(result.success?).to eq(true)
472
+ expect(result.customer.custom_fields).to eq({})
473
473
  end
474
474
 
475
475
  it "returns nested errors if credit card and/or billing address are invalid" do
@@ -482,10 +482,10 @@ describe Braintree::Customer do
482
482
  }
483
483
  },
484
484
  )
485
- result.success?.should == false
486
- result.errors.for(:customer).on(:email)[0].message.should == "Email is an invalid format."
487
- result.errors.for(:customer).for(:credit_card).on(:number)[0].message.should == "Credit card number is invalid."
488
- result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_name)[0].message.should == "Country name is not an accepted country."
485
+ expect(result.success?).to eq(false)
486
+ expect(result.errors.for(:customer).on(:email)[0].message).to eq("Email is an invalid format.")
487
+ expect(result.errors.for(:customer).for(:credit_card).on(:number)[0].message).to eq("Credit card number is invalid.")
488
+ expect(result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_name)[0].message).to eq("Country name is not an accepted country.")
489
489
  end
490
490
 
491
491
  it "returns errors if country codes are inconsistent" do
@@ -502,8 +502,8 @@ describe Braintree::Customer do
502
502
  }
503
503
  },
504
504
  )
505
- result.success?.should == false
506
- result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:base).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::InconsistentCountry)
505
+ expect(result.success?).to eq(false)
506
+ expect(result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:base).map { |e| e.code }).to include(Braintree::ErrorCodes::Address::InconsistentCountry)
507
507
  end
508
508
 
509
509
  it "returns an error if country code alpha2 is invalid" do
@@ -518,8 +518,8 @@ describe Braintree::Customer do
518
518
  }
519
519
  },
520
520
  )
521
- result.success?.should == false
522
- result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_code_alpha2).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::CountryCodeAlpha2IsNotAccepted)
521
+ expect(result.success?).to eq(false)
522
+ expect(result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_code_alpha2).map { |e| e.code }).to include(Braintree::ErrorCodes::Address::CountryCodeAlpha2IsNotAccepted)
523
523
  end
524
524
 
525
525
  it "returns an error if country code alpha3 is invalid" do
@@ -534,8 +534,8 @@ describe Braintree::Customer do
534
534
  }
535
535
  },
536
536
  )
537
- result.success?.should == false
538
- result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_code_alpha3).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::CountryCodeAlpha3IsNotAccepted)
537
+ expect(result.success?).to eq(false)
538
+ expect(result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_code_alpha3).map { |e| e.code }).to include(Braintree::ErrorCodes::Address::CountryCodeAlpha3IsNotAccepted)
539
539
  end
540
540
 
541
541
  it "returns an error if country code numeric is invalid" do
@@ -550,8 +550,8 @@ describe Braintree::Customer do
550
550
  }
551
551
  },
552
552
  )
553
- result.success?.should == false
554
- result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_code_numeric).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::CountryCodeNumericIsNotAccepted)
553
+ expect(result.success?).to eq(false)
554
+ expect(result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_code_numeric).map { |e| e.code }).to include(Braintree::ErrorCodes::Address::CountryCodeNumericIsNotAccepted)
555
555
  end
556
556
 
557
557
  it "returns errors if custom_fields are not registered" do
@@ -562,8 +562,8 @@ describe Braintree::Customer do
562
562
  :spouse_name => "Jacqueline"
563
563
  },
564
564
  )
565
- result.success?.should == false
566
- result.errors.for(:customer).on(:custom_fields)[0].message.should == "Custom field is invalid: spouse_name."
565
+ expect(result.success?).to eq(false)
566
+ expect(result.errors.for(:customer).on(:custom_fields)[0].message).to eq("Custom field is invalid: spouse_name.")
567
567
  end
568
568
 
569
569
  context "client API" do
@@ -583,24 +583,24 @@ describe Braintree::Customer do
583
583
  },
584
584
  )
585
585
 
586
- result.success?.should == true
587
- result.customer.credit_cards.first.bin.should == "411111"
588
- result.customer.credit_cards.first.last_4.should == "1111"
586
+ expect(result.success?).to eq(true)
587
+ expect(result.customer.credit_cards.first.bin).to eq("411111")
588
+ expect(result.customer.credit_cards.first.last_4).to eq("1111")
589
589
  end
590
590
  end
591
591
 
592
592
  it "can create a customer with an apple pay payment method" do
593
593
  result = Braintree::Customer.create(:payment_method_nonce => Braintree::Test::Nonce::ApplePayVisa)
594
594
 
595
- result.success?.should == true
596
- result.customer.payment_methods.should_not be_empty
597
- result.customer.payment_methods.first.token.should_not be_nil
595
+ expect(result.success?).to eq(true)
596
+ expect(result.customer.payment_methods).not_to be_empty
597
+ expect(result.customer.payment_methods.first.token).not_to be_nil
598
598
  end
599
599
 
600
600
  it "can create a customer with an unknown payment method" do
601
601
  result = Braintree::Customer.create(:payment_method_nonce => Braintree::Test::Nonce::AbstractTransactable)
602
602
 
603
- result.success?.should == true
603
+ expect(result.success?).to eq(true)
604
604
  end
605
605
 
606
606
  context "verification_account_type" do
@@ -701,14 +701,14 @@ describe Braintree::Customer do
701
701
  :first_name => "Jim",
702
702
  :last_name => "Smith",
703
703
  )
704
- customer.id.should =~ /\d+/
705
- customer.first_name.should == "Jim"
706
- customer.last_name.should == "Smith"
704
+ expect(customer.id).to match(/\d+/)
705
+ expect(customer.first_name).to eq("Jim")
706
+ expect(customer.last_name).to eq("Smith")
707
707
  end
708
708
 
709
709
  it "can create without any attributes" do
710
710
  customer = Braintree::Customer.create!
711
- customer.id.should =~ /\d+/
711
+ expect(customer.id).to match(/\d+/)
712
712
  end
713
713
 
714
714
  it "raises an exception if not successful" do
@@ -727,14 +727,14 @@ describe Braintree::Customer do
727
727
  },
728
728
  )
729
729
  result = Braintree::Customer.credit(customer.id, :amount => "100.00")
730
- result.success?.should == true
731
- result.transaction.amount.should == BigDecimal("100.00")
732
- result.transaction.type.should == "credit"
733
- result.transaction.customer_details.id.should == customer.id
734
- result.transaction.credit_card_details.token.should == customer.credit_cards[0].token
735
- result.transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
736
- result.transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
737
- result.transaction.credit_card_details.expiration_date.should == "05/2010"
730
+ expect(result.success?).to eq(true)
731
+ expect(result.transaction.amount).to eq(BigDecimal("100.00"))
732
+ expect(result.transaction.type).to eq("credit")
733
+ expect(result.transaction.customer_details.id).to eq(customer.id)
734
+ expect(result.transaction.credit_card_details.token).to eq(customer.credit_cards[0].token)
735
+ expect(result.transaction.credit_card_details.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
736
+ expect(result.transaction.credit_card_details.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
737
+ expect(result.transaction.credit_card_details.expiration_date).to eq("05/2010")
738
738
  end
739
739
  end
740
740
 
@@ -747,13 +747,13 @@ describe Braintree::Customer do
747
747
  },
748
748
  )
749
749
  transaction = Braintree::Customer.credit!(customer.id, :amount => "100.00")
750
- transaction.amount.should == BigDecimal("100.00")
751
- transaction.type.should == "credit"
752
- transaction.customer_details.id.should == customer.id
753
- transaction.credit_card_details.token.should == customer.credit_cards[0].token
754
- transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
755
- transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
756
- transaction.credit_card_details.expiration_date.should == "05/2010"
750
+ expect(transaction.amount).to eq(BigDecimal("100.00"))
751
+ expect(transaction.type).to eq("credit")
752
+ expect(transaction.customer_details.id).to eq(customer.id)
753
+ expect(transaction.credit_card_details.token).to eq(customer.credit_cards[0].token)
754
+ expect(transaction.credit_card_details.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
755
+ expect(transaction.credit_card_details.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
756
+ expect(transaction.credit_card_details.expiration_date).to eq("05/2010")
757
757
  end
758
758
  end
759
759
 
@@ -766,14 +766,14 @@ describe Braintree::Customer do
766
766
  },
767
767
  )
768
768
  result = Braintree::Customer.sale(customer.id, :amount => "100.00")
769
- result.success?.should == true
770
- result.transaction.amount.should == BigDecimal("100.00")
771
- result.transaction.type.should == "sale"
772
- result.transaction.customer_details.id.should == customer.id
773
- result.transaction.credit_card_details.token.should == customer.credit_cards[0].token
774
- result.transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
775
- result.transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
776
- result.transaction.credit_card_details.expiration_date.should == "05/2010"
769
+ expect(result.success?).to eq(true)
770
+ expect(result.transaction.amount).to eq(BigDecimal("100.00"))
771
+ expect(result.transaction.type).to eq("sale")
772
+ expect(result.transaction.customer_details.id).to eq(customer.id)
773
+ expect(result.transaction.credit_card_details.token).to eq(customer.credit_cards[0].token)
774
+ expect(result.transaction.credit_card_details.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
775
+ expect(result.transaction.credit_card_details.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
776
+ expect(result.transaction.credit_card_details.expiration_date).to eq("05/2010")
777
777
  end
778
778
  end
779
779
 
@@ -786,13 +786,13 @@ describe Braintree::Customer do
786
786
  },
787
787
  )
788
788
  transaction = Braintree::Customer.sale!(customer.id, :amount => "100.00")
789
- transaction.amount.should == BigDecimal("100.00")
790
- transaction.type.should == "sale"
791
- transaction.customer_details.id.should == customer.id
792
- transaction.credit_card_details.token.should == customer.credit_cards[0].token
793
- transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
794
- transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
795
- transaction.credit_card_details.expiration_date.should == "05/2010"
789
+ expect(transaction.amount).to eq(BigDecimal("100.00"))
790
+ expect(transaction.type).to eq("sale")
791
+ expect(transaction.customer_details.id).to eq(customer.id)
792
+ expect(transaction.credit_card_details.token).to eq(customer.credit_cards[0].token)
793
+ expect(transaction.credit_card_details.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
794
+ expect(transaction.credit_card_details.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
795
+ expect(transaction.credit_card_details.expiration_date).to eq("05/2010")
796
796
  end
797
797
  end
798
798
 
@@ -806,7 +806,7 @@ describe Braintree::Customer do
806
806
  )
807
807
  transaction = Braintree::Customer.sale!(customer.id, :amount => "100.00")
808
808
  collection = Braintree::Customer.transactions(customer.id)
809
- collection.first.should == transaction
809
+ expect(collection.first).to eq(transaction)
810
810
  end
811
811
  end
812
812
 
@@ -821,14 +821,14 @@ describe Braintree::Customer do
821
821
  result = customer.credit(
822
822
  :amount => "100.00",
823
823
  )
824
- result.success?.should == true
825
- result.transaction.amount.should == BigDecimal("100.00")
826
- result.transaction.type.should == "credit"
827
- result.transaction.customer_details.id.should == customer.id
828
- result.transaction.credit_card_details.token.should == customer.credit_cards[0].token
829
- result.transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
830
- result.transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
831
- result.transaction.credit_card_details.expiration_date.should == "05/2010"
824
+ expect(result.success?).to eq(true)
825
+ expect(result.transaction.amount).to eq(BigDecimal("100.00"))
826
+ expect(result.transaction.type).to eq("credit")
827
+ expect(result.transaction.customer_details.id).to eq(customer.id)
828
+ expect(result.transaction.credit_card_details.token).to eq(customer.credit_cards[0].token)
829
+ expect(result.transaction.credit_card_details.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
830
+ expect(result.transaction.credit_card_details.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
831
+ expect(result.transaction.credit_card_details.expiration_date).to eq("05/2010")
832
832
  end
833
833
  end
834
834
 
@@ -841,13 +841,13 @@ describe Braintree::Customer do
841
841
  },
842
842
  )
843
843
  transaction = customer.credit!(:amount => "100.00")
844
- transaction.amount.should == BigDecimal("100.00")
845
- transaction.type.should == "credit"
846
- transaction.customer_details.id.should == customer.id
847
- transaction.credit_card_details.token.should == customer.credit_cards[0].token
848
- transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
849
- transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
850
- transaction.credit_card_details.expiration_date.should == "05/2010"
844
+ expect(transaction.amount).to eq(BigDecimal("100.00"))
845
+ expect(transaction.type).to eq("credit")
846
+ expect(transaction.customer_details.id).to eq(customer.id)
847
+ expect(transaction.credit_card_details.token).to eq(customer.credit_cards[0].token)
848
+ expect(transaction.credit_card_details.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
849
+ expect(transaction.credit_card_details.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
850
+ expect(transaction.credit_card_details.expiration_date).to eq("05/2010")
851
851
  end
852
852
  end
853
853
 
@@ -857,10 +857,10 @@ describe Braintree::Customer do
857
857
  :first_name => "Joe",
858
858
  :last_name => "Cool",
859
859
  )
860
- result.success?.should == true
860
+ expect(result.success?).to eq(true)
861
861
 
862
862
  customer = result.customer
863
- customer.delete.success?.should == true
863
+ expect(customer.delete.success?).to eq(true)
864
864
  expect do
865
865
  Braintree::Customer.find(customer.id)
866
866
  end.to raise_error(Braintree::NotFoundError)
@@ -874,13 +874,13 @@ describe Braintree::Customer do
874
874
  :first_name => "Joe",
875
875
  :last_name => "Cool",
876
876
  )
877
- result.success?.should == true
877
+ expect(result.success?).to eq(true)
878
878
 
879
879
  customer = Braintree::Customer.find(result.customer.id)
880
- customer.id.should == result.customer.id
881
- customer.graphql_id.should_not be_nil
882
- customer.first_name.should == "Joe"
883
- customer.last_name.should == "Cool"
880
+ expect(customer.id).to eq(result.customer.id)
881
+ expect(customer.graphql_id).not_to be_nil
882
+ expect(customer.first_name).to eq("Joe")
883
+ expect(customer.last_name).to eq("Cool")
884
884
  end
885
885
 
886
886
  it "returns associated subscriptions" do
@@ -898,10 +898,10 @@ describe Braintree::Customer do
898
898
  ).subscription
899
899
 
900
900
  found_customer = Braintree::Customer.find(customer.id)
901
- found_customer.credit_cards.first.subscriptions.first.id.should == subscription.id
902
- found_customer.credit_cards.first.subscriptions.first.plan_id.should == "integration_trialless_plan"
903
- found_customer.credit_cards.first.subscriptions.first.payment_method_token.should == credit_card.token
904
- found_customer.credit_cards.first.subscriptions.first.price.should == BigDecimal("1.00")
901
+ expect(found_customer.credit_cards.first.subscriptions.first.id).to eq(subscription.id)
902
+ expect(found_customer.credit_cards.first.subscriptions.first.plan_id).to eq("integration_trialless_plan")
903
+ expect(found_customer.credit_cards.first.subscriptions.first.payment_method_token).to eq(credit_card.token)
904
+ expect(found_customer.credit_cards.first.subscriptions.first.price).to eq(BigDecimal("1.00"))
905
905
  end
906
906
 
907
907
  context "when given an association filter id" do
@@ -933,10 +933,10 @@ describe Braintree::Customer do
933
933
  found_customer = Braintree::Customer.find(customer.id, {
934
934
  :association_filter_id => "customernoassociations"
935
935
  })
936
- found_customer.credit_cards.length.should == 0
937
- found_customer.payment_methods.length.should == 0
938
- found_customer.addresses.length.should == 0
939
- found_customer.custom_fields.should == {}
936
+ expect(found_customer.credit_cards.length).to eq(0)
937
+ expect(found_customer.payment_methods.length).to eq(0)
938
+ expect(found_customer.addresses.length).to eq(0)
939
+ expect(found_customer.custom_fields).to eq({})
940
940
  end
941
941
 
942
942
  it "filters out nested filterable associations" do
@@ -968,12 +968,12 @@ describe Braintree::Customer do
968
968
  :association_filter_id => "customertoplevelassociations"
969
969
  })
970
970
 
971
- found_customer.credit_cards.length.should == 1
972
- found_customer.credit_cards.first.subscriptions.length.should == 0
973
- found_customer.payment_methods.length.should == 1
974
- found_customer.payment_methods.first.subscriptions.length.should == 0
975
- found_customer.addresses.length.should == 1
976
- found_customer.custom_fields.length.should == 1
971
+ expect(found_customer.credit_cards.length).to eq(1)
972
+ expect(found_customer.credit_cards.first.subscriptions.length).to eq(0)
973
+ expect(found_customer.payment_methods.length).to eq(1)
974
+ expect(found_customer.payment_methods.first.subscriptions.length).to eq(0)
975
+ expect(found_customer.addresses.length).to eq(1)
976
+ expect(found_customer.custom_fields.length).to eq(1)
977
977
  end
978
978
  end
979
979
 
@@ -981,89 +981,89 @@ describe Braintree::Customer do
981
981
  result = Braintree::Customer.create(
982
982
  :payment_method_nonce => Braintree::Test::Nonce::ApplePayAmEx,
983
983
  )
984
- result.success?.should == true
984
+ expect(result.success?).to eq(true)
985
985
 
986
986
  found_customer = Braintree::Customer.find(result.customer.id)
987
- found_customer.apple_pay_cards.should_not be_nil
987
+ expect(found_customer.apple_pay_cards).not_to be_nil
988
988
  apple_pay_card = found_customer.apple_pay_cards.first
989
- apple_pay_card.should be_a Braintree::ApplePayCard
990
- apple_pay_card.token.should_not be_nil
991
- apple_pay_card.expiration_year.should_not be_nil
992
- apple_pay_card.payment_instrument_name.should == "AmEx 41002"
993
- apple_pay_card.commercial.should_not be_nil
994
- apple_pay_card.country_of_issuance.should_not be_nil
995
- apple_pay_card.debit.should_not be_nil
996
- apple_pay_card.durbin_regulated.should_not be_nil
997
- apple_pay_card.healthcare.should_not be_nil
998
- apple_pay_card.issuing_bank.should_not be_nil
999
- apple_pay_card.payroll.should_not be_nil
1000
- apple_pay_card.prepaid.should_not be_nil
1001
- apple_pay_card.product_id.should_not be_nil
989
+ expect(apple_pay_card).to be_a Braintree::ApplePayCard
990
+ expect(apple_pay_card.token).not_to be_nil
991
+ expect(apple_pay_card.expiration_year).not_to be_nil
992
+ expect(apple_pay_card.payment_instrument_name).to eq("AmEx 41002")
993
+ expect(apple_pay_card.commercial).not_to be_nil
994
+ expect(apple_pay_card.country_of_issuance).not_to be_nil
995
+ expect(apple_pay_card.debit).not_to be_nil
996
+ expect(apple_pay_card.durbin_regulated).not_to be_nil
997
+ expect(apple_pay_card.healthcare).not_to be_nil
998
+ expect(apple_pay_card.issuing_bank).not_to be_nil
999
+ expect(apple_pay_card.payroll).not_to be_nil
1000
+ expect(apple_pay_card.prepaid).not_to be_nil
1001
+ expect(apple_pay_card.product_id).not_to be_nil
1002
1002
  end
1003
1003
 
1004
1004
  it "returns associated google pay proxy cards" do
1005
1005
  result = Braintree::Customer.create(
1006
1006
  :payment_method_nonce => Braintree::Test::Nonce::GooglePayDiscover,
1007
1007
  )
1008
- result.success?.should == true
1008
+ expect(result.success?).to eq(true)
1009
1009
 
1010
1010
  found_customer = Braintree::Customer.find(result.customer.id)
1011
- found_customer.google_pay_cards.size.should == 1
1012
- found_customer.payment_methods.size.should == 1
1011
+ expect(found_customer.google_pay_cards.size).to eq(1)
1012
+ expect(found_customer.payment_methods.size).to eq(1)
1013
1013
  google_pay_card = found_customer.google_pay_cards.first
1014
- google_pay_card.should be_a Braintree::GooglePayCard
1015
- google_pay_card.token.should_not be_nil
1016
- google_pay_card.expiration_year.should_not be_nil
1017
- google_pay_card.is_network_tokenized?.should == false
1018
- google_pay_card.commercial.should_not be_nil
1019
- google_pay_card.country_of_issuance.should_not be_nil
1020
- google_pay_card.debit.should_not be_nil
1021
- google_pay_card.durbin_regulated.should_not be_nil
1022
- google_pay_card.healthcare.should_not be_nil
1023
- google_pay_card.issuing_bank.should_not be_nil
1024
- google_pay_card.payroll.should_not be_nil
1025
- google_pay_card.prepaid.should_not be_nil
1026
- google_pay_card.product_id.should_not be_nil
1014
+ expect(google_pay_card).to be_a Braintree::GooglePayCard
1015
+ expect(google_pay_card.token).not_to be_nil
1016
+ expect(google_pay_card.expiration_year).not_to be_nil
1017
+ expect(google_pay_card.is_network_tokenized?).to eq(false)
1018
+ expect(google_pay_card.commercial).not_to be_nil
1019
+ expect(google_pay_card.country_of_issuance).not_to be_nil
1020
+ expect(google_pay_card.debit).not_to be_nil
1021
+ expect(google_pay_card.durbin_regulated).not_to be_nil
1022
+ expect(google_pay_card.healthcare).not_to be_nil
1023
+ expect(google_pay_card.issuing_bank).not_to be_nil
1024
+ expect(google_pay_card.payroll).not_to be_nil
1025
+ expect(google_pay_card.prepaid).not_to be_nil
1026
+ expect(google_pay_card.product_id).not_to be_nil
1027
1027
  end
1028
1028
 
1029
1029
  it "returns associated google pay network tokens" do
1030
1030
  result = Braintree::Customer.create(
1031
1031
  :payment_method_nonce => Braintree::Test::Nonce::GooglePayMasterCard,
1032
1032
  )
1033
- result.success?.should == true
1033
+ expect(result.success?).to eq(true)
1034
1034
 
1035
1035
  found_customer = Braintree::Customer.find(result.customer.id)
1036
- found_customer.google_pay_cards.size.should == 1
1037
- found_customer.payment_methods.size.should == 1
1036
+ expect(found_customer.google_pay_cards.size).to eq(1)
1037
+ expect(found_customer.payment_methods.size).to eq(1)
1038
1038
  google_pay_card = found_customer.google_pay_cards.first
1039
- google_pay_card.should be_a Braintree::GooglePayCard
1040
- google_pay_card.token.should_not be_nil
1041
- google_pay_card.expiration_year.should_not be_nil
1042
- google_pay_card.is_network_tokenized?.should == true
1043
- google_pay_card.commercial.should_not be_nil
1044
- google_pay_card.country_of_issuance.should_not be_nil
1045
- google_pay_card.debit.should_not be_nil
1046
- google_pay_card.durbin_regulated.should_not be_nil
1047
- google_pay_card.healthcare.should_not be_nil
1048
- google_pay_card.issuing_bank.should_not be_nil
1049
- google_pay_card.payroll.should_not be_nil
1050
- google_pay_card.prepaid.should_not be_nil
1051
- google_pay_card.product_id.should_not be_nil
1039
+ expect(google_pay_card).to be_a Braintree::GooglePayCard
1040
+ expect(google_pay_card.token).not_to be_nil
1041
+ expect(google_pay_card.expiration_year).not_to be_nil
1042
+ expect(google_pay_card.is_network_tokenized?).to eq(true)
1043
+ expect(google_pay_card.commercial).not_to be_nil
1044
+ expect(google_pay_card.country_of_issuance).not_to be_nil
1045
+ expect(google_pay_card.debit).not_to be_nil
1046
+ expect(google_pay_card.durbin_regulated).not_to be_nil
1047
+ expect(google_pay_card.healthcare).not_to be_nil
1048
+ expect(google_pay_card.issuing_bank).not_to be_nil
1049
+ expect(google_pay_card.payroll).not_to be_nil
1050
+ expect(google_pay_card.prepaid).not_to be_nil
1051
+ expect(google_pay_card.product_id).not_to be_nil
1052
1052
  end
1053
1053
 
1054
1054
  it "returns associated venmo accounts" do
1055
1055
  result = Braintree::Customer.create(
1056
1056
  :payment_method_nonce => Braintree::Test::Nonce::VenmoAccount,
1057
1057
  )
1058
- result.success?.should == true
1058
+ expect(result.success?).to eq(true)
1059
1059
 
1060
1060
  found_customer = Braintree::Customer.find(result.customer.id)
1061
- found_customer.venmo_accounts.size.should == 1
1062
- found_customer.payment_methods.size.should == 1
1061
+ expect(found_customer.venmo_accounts.size).to eq(1)
1062
+ expect(found_customer.payment_methods.size).to eq(1)
1063
1063
  venmo_account = found_customer.venmo_accounts.first
1064
- venmo_account.should be_a Braintree::VenmoAccount
1065
- venmo_account.token.should_not be_nil
1066
- venmo_account.username.should_not be_nil
1064
+ expect(venmo_account).to be_a Braintree::VenmoAccount
1065
+ expect(venmo_account.token).not_to be_nil
1066
+ expect(venmo_account.username).not_to be_nil
1067
1067
  end
1068
1068
 
1069
1069
  xit "returns associated us bank accounts" do
@@ -1075,25 +1075,25 @@ describe Braintree::Customer do
1075
1075
  }
1076
1076
  },
1077
1077
  )
1078
- result.should be_success
1078
+ expect(result).to be_success
1079
1079
 
1080
1080
  found_customer = Braintree::Customer.find(result.customer.id)
1081
- found_customer.us_bank_accounts.size.should == 1
1082
- found_customer.payment_methods.size.should == 1
1081
+ expect(found_customer.us_bank_accounts.size).to eq(1)
1082
+ expect(found_customer.payment_methods.size).to eq(1)
1083
1083
 
1084
1084
  us_bank_account = found_customer.us_bank_accounts.first
1085
- us_bank_account.should be_a(Braintree::UsBankAccount)
1086
- us_bank_account.routing_number.should == "021000021"
1087
- us_bank_account.last_4.should == "0000"
1088
- us_bank_account.account_type.should == "checking"
1089
- us_bank_account.account_holder_name.should == "John Doe"
1090
- us_bank_account.bank_name.should =~ /CHASE/
1085
+ expect(us_bank_account).to be_a(Braintree::UsBankAccount)
1086
+ expect(us_bank_account.routing_number).to eq("021000021")
1087
+ expect(us_bank_account.last_4).to eq("0000")
1088
+ expect(us_bank_account.account_type).to eq("checking")
1089
+ expect(us_bank_account.account_holder_name).to eq("John Doe")
1090
+ expect(us_bank_account.bank_name).to match(/CHASE/)
1091
1091
  end
1092
1092
 
1093
1093
  it "works for a blank customer" do
1094
1094
  created_customer = Braintree::Customer.create!
1095
1095
  found_customer = Braintree::Customer.find(created_customer.id)
1096
- found_customer.id.should == created_customer.id
1096
+ expect(found_customer.id).to eq(created_customer.id)
1097
1097
  end
1098
1098
 
1099
1099
  it "raises an ArgumentError if customer_id is not a string" do
@@ -1132,7 +1132,7 @@ describe Braintree::Customer do
1132
1132
  :number => 4111111111111111,
1133
1133
  :expiration_date => "05/2060",
1134
1134
  :three_d_secure_pass_thru => {
1135
- :eci_flag => "02",
1135
+ :eci_flag => "05",
1136
1136
  :cavv => "some_cavv",
1137
1137
  :xid => "some_xid",
1138
1138
  :three_d_secure_version => "1.0.2",
@@ -1144,11 +1144,11 @@ describe Braintree::Customer do
1144
1144
  :options => {:verify_card => true},
1145
1145
  },
1146
1146
  )
1147
- result.success?.should == true
1148
- result.customer.id.should == customer.id
1149
- result.customer.first_name.should == "Mr. Joe"
1150
- result.customer.last_name.should == "Super Cool"
1151
- result.customer.custom_fields[:store_me].should == "a value"
1147
+ expect(result.success?).to eq(true)
1148
+ expect(result.customer.id).to eq(customer.id)
1149
+ expect(result.customer.first_name).to eq("Mr. Joe")
1150
+ expect(result.customer.last_name).to eq("Super Cool")
1151
+ expect(result.customer.custom_fields[:store_me]).to eq("a value")
1152
1152
  end
1153
1153
 
1154
1154
  it "validates the presence of three_d_secure_version while passing three_d_secure_pass_thru in update" do
@@ -1167,7 +1167,7 @@ describe Braintree::Customer do
1167
1167
  :number => 4111111111111111,
1168
1168
  :expiration_date => "05/2060",
1169
1169
  :three_d_secure_pass_thru => {
1170
- :eci_flag => "02",
1170
+ :eci_flag => "05",
1171
1171
  :cavv => "some_cavv",
1172
1172
  :xid => "some_xid",
1173
1173
  :authentication_response => "Y",
@@ -1197,11 +1197,11 @@ describe Braintree::Customer do
1197
1197
  :store_me => "a value"
1198
1198
  },
1199
1199
  )
1200
- result.success?.should == true
1201
- result.customer.id.should == customer.id
1202
- result.customer.first_name.should == "Mr. Joe"
1203
- result.customer.last_name.should == "Super Cool"
1204
- result.customer.custom_fields[:store_me].should == "a value"
1200
+ expect(result.success?).to eq(true)
1201
+ expect(result.customer.id).to eq(customer.id)
1202
+ expect(result.customer.first_name).to eq("Mr. Joe")
1203
+ expect(result.customer.last_name).to eq("Super Cool")
1204
+ expect(result.customer.custom_fields[:store_me]).to eq("a value")
1205
1205
  end
1206
1206
 
1207
1207
  it "does not update customer with duplicate payment method if fail_on_payment_method option set" do
@@ -1221,8 +1221,8 @@ describe Braintree::Customer do
1221
1221
  }
1222
1222
  },
1223
1223
  )
1224
- result.success?.should == false
1225
- result.errors.for(:customer).for(:credit_card).on(:number)[0].message.should == "Duplicate card exists in the vault."
1224
+ expect(result.success?).to eq(false)
1225
+ expect(result.errors.for(:customer).for(:credit_card).on(:number)[0].message).to eq("Duplicate card exists in the vault.")
1226
1226
  end
1227
1227
 
1228
1228
  it "updates the default payment method" do
@@ -1240,7 +1240,7 @@ describe Braintree::Customer do
1240
1240
  )
1241
1241
 
1242
1242
  payment_method1 = Braintree::PaymentMethod.find(token1)
1243
- payment_method1.should be_default
1243
+ expect(payment_method1).to be_default
1244
1244
 
1245
1245
  token2 = random_payment_method_token
1246
1246
 
@@ -1255,7 +1255,7 @@ describe Braintree::Customer do
1255
1255
  )
1256
1256
 
1257
1257
  payment_method2 = Braintree::PaymentMethod.find(token2)
1258
- payment_method2.should be_default
1258
+ expect(payment_method2).to be_default
1259
1259
  end
1260
1260
 
1261
1261
  it "updates the default payment method in the options" do
@@ -1273,7 +1273,7 @@ describe Braintree::Customer do
1273
1273
  )
1274
1274
 
1275
1275
  payment_method1 = Braintree::PaymentMethod.find(token1)
1276
- payment_method1.should be_default
1276
+ expect(payment_method1).to be_default
1277
1277
 
1278
1278
  token2 = random_payment_method_token
1279
1279
 
@@ -1293,7 +1293,7 @@ describe Braintree::Customer do
1293
1293
  )
1294
1294
 
1295
1295
  payment_method2 = Braintree::PaymentMethod.find(token2)
1296
- payment_method2.should be_default
1296
+ expect(payment_method2).to be_default
1297
1297
  end
1298
1298
 
1299
1299
  it "can use any country code" do
@@ -1316,11 +1316,11 @@ describe Braintree::Customer do
1316
1316
  }
1317
1317
  },
1318
1318
  )
1319
- result.success?.should == true
1320
- result.customer.addresses[0].country_name.should == "Fiji"
1321
- result.customer.addresses[0].country_code_alpha2.should == "FJ"
1322
- result.customer.addresses[0].country_code_alpha3.should == "FJI"
1323
- result.customer.addresses[0].country_code_numeric.should == "242"
1319
+ expect(result.success?).to eq(true)
1320
+ expect(result.customer.addresses[0].country_name).to eq("Fiji")
1321
+ expect(result.customer.addresses[0].country_code_alpha2).to eq("FJ")
1322
+ expect(result.customer.addresses[0].country_code_alpha3).to eq("FJI")
1323
+ expect(result.customer.addresses[0].country_code_numeric).to eq("242")
1324
1324
  end
1325
1325
 
1326
1326
  it "can update the customer, credit card, and billing address in one request" do
@@ -1349,18 +1349,18 @@ describe Braintree::Customer do
1349
1349
  }
1350
1350
  },
1351
1351
  )
1352
- result.success?.should == true
1353
- result.customer.id.should == customer.id
1354
- result.customer.first_name.should == "New Joe"
1352
+ expect(result.success?).to eq(true)
1353
+ expect(result.customer.id).to eq(customer.id)
1354
+ expect(result.customer.first_name).to eq("New Joe")
1355
1355
 
1356
- result.customer.credit_cards.size.should == 1
1356
+ expect(result.customer.credit_cards.size).to eq(1)
1357
1357
  credit_card = result.customer.credit_cards.first
1358
- credit_card.bin.should == Braintree::Test::CreditCardNumbers::Visa.slice(0, 6)
1359
- credit_card.cardholder_name.should == "New Joe Cardholder"
1358
+ expect(credit_card.bin).to eq(Braintree::Test::CreditCardNumbers::Visa.slice(0, 6))
1359
+ expect(credit_card.cardholder_name).to eq("New Joe Cardholder")
1360
1360
 
1361
- credit_card.billing_address.first_name.should == "Joe"
1362
- credit_card.billing_address.last_name.should == "Cool"
1363
- credit_card.billing_address.postal_code.should == "60666"
1361
+ expect(credit_card.billing_address.first_name).to eq("Joe")
1362
+ expect(credit_card.billing_address.last_name).to eq("Cool")
1363
+ expect(credit_card.billing_address.postal_code).to eq("60666")
1364
1364
  end
1365
1365
 
1366
1366
  it "can update the customer and verify_card with a specific verification_amount" do
@@ -1378,7 +1378,7 @@ describe Braintree::Customer do
1378
1378
  :options => {:verify_card => true, :verification_amount => "2.00"}
1379
1379
  },
1380
1380
  )
1381
- result.success?.should == true
1381
+ expect(result.success?).to eq(true)
1382
1382
  end
1383
1383
 
1384
1384
  it "includes risk data when skip_advanced_fraud_checking is false" do
@@ -1443,7 +1443,7 @@ describe Braintree::Customer do
1443
1443
  customer.id,
1444
1444
  :tax_identifiers => [{:country_code => "US", :identifier => "567891234"}],
1445
1445
  )
1446
- result.success?.should == true
1446
+ expect(result.success?).to eq(true)
1447
1447
  end
1448
1448
 
1449
1449
  it "validates presence of three_d_secure_version in 3ds pass thru params" do
@@ -1451,7 +1451,7 @@ describe Braintree::Customer do
1451
1451
  :payment_method_nonce => Braintree::Test::Nonce::ThreeDSecureVisaFullAuthentication,
1452
1452
  :credit_card => {
1453
1453
  :three_d_secure_pass_thru => {
1454
- :eci_flag => "02",
1454
+ :eci_flag => "05",
1455
1455
  :cavv => "some_cavv",
1456
1456
  :xid => "some_xid",
1457
1457
  :three_d_secure_version => "xx",
@@ -1475,7 +1475,7 @@ describe Braintree::Customer do
1475
1475
  :payment_method_nonce => Braintree::Test::Nonce::ThreeDSecureVisaFullAuthentication,
1476
1476
  :credit_card => {
1477
1477
  :three_d_secure_pass_thru => {
1478
- :eci_flag => "02",
1478
+ :eci_flag => "05",
1479
1479
  :cavv => "some_cavv",
1480
1480
  :xid => "some_xid",
1481
1481
  :three_d_secure_version => "2.2.1",
@@ -1498,18 +1498,18 @@ describe Braintree::Customer do
1498
1498
  :options => {:verify_card => true}
1499
1499
  },
1500
1500
  )
1501
- result.success?.should == true
1501
+ expect(result.success?).to eq(true)
1502
1502
 
1503
1503
  three_d_secure_info = result.customer.payment_methods.first.verification.three_d_secure_info
1504
- three_d_secure_info.enrolled.should == "Y"
1505
- three_d_secure_info.should be_liability_shifted
1506
- three_d_secure_info.should be_liability_shift_possible
1507
- three_d_secure_info.status.should == "authenticate_successful"
1508
- three_d_secure_info.cavv.should == "cavv_value"
1509
- three_d_secure_info.xid.should == "xid_value"
1510
- three_d_secure_info.eci_flag.should == "05"
1511
- three_d_secure_info.three_d_secure_version.should == "1.0.2"
1512
- three_d_secure_info.ds_transaction_id.should == nil
1504
+ expect(three_d_secure_info.enrolled).to eq("Y")
1505
+ expect(three_d_secure_info).to be_liability_shifted
1506
+ expect(three_d_secure_info).to be_liability_shift_possible
1507
+ expect(three_d_secure_info.status).to eq("authenticate_successful")
1508
+ expect(three_d_secure_info.cavv).to eq("cavv_value")
1509
+ expect(three_d_secure_info.xid).to eq("xid_value")
1510
+ expect(three_d_secure_info.eci_flag).to eq("05")
1511
+ expect(three_d_secure_info.three_d_secure_version).to eq("1.0.2")
1512
+ expect(three_d_secure_info.ds_transaction_id).to eq(nil)
1513
1513
  end
1514
1514
 
1515
1515
  it "can update the nested billing address with billing_address_id" do
@@ -1531,9 +1531,9 @@ describe Braintree::Customer do
1531
1531
  ).customer
1532
1532
 
1533
1533
  billing_address = customer.credit_cards.first.billing_address
1534
- billing_address.id.should == address.id
1535
- billing_address.first_name.should == "John"
1536
- billing_address.last_name.should == "Doe"
1534
+ expect(billing_address.id).to eq(address.id)
1535
+ expect(billing_address.first_name).to eq("John")
1536
+ expect(billing_address.last_name).to eq("Doe")
1537
1537
  end
1538
1538
 
1539
1539
  it "returns an error response if invalid" do
@@ -1542,8 +1542,8 @@ describe Braintree::Customer do
1542
1542
  customer.id,
1543
1543
  :email => "@invalid.com",
1544
1544
  )
1545
- result.success?.should == false
1546
- result.errors.for(:customer).on(:email)[0].message.should == "Email is an invalid format."
1545
+ expect(result.success?).to eq(false)
1546
+ expect(result.errors.for(:customer).on(:email)[0].message).to eq("Email is an invalid format.")
1547
1547
  end
1548
1548
 
1549
1549
  context "verification_currency_iso_code" do
@@ -1562,7 +1562,7 @@ describe Braintree::Customer do
1562
1562
  :options => {:verify_card => true, :verification_currency_iso_code => "USD"}
1563
1563
  },
1564
1564
  )
1565
- result.success?.should == true
1565
+ expect(result.success?).to eq(true)
1566
1566
  result.customer.credit_cards[0].verification.currency_iso_code == "USD"
1567
1567
  end
1568
1568
 
@@ -1581,7 +1581,7 @@ describe Braintree::Customer do
1581
1581
  :options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "USD"}
1582
1582
  },
1583
1583
  )
1584
- result.success?.should == true
1584
+ expect(result.success?).to eq(true)
1585
1585
  result.customer.credit_cards[0].verification.currency_iso_code == "USD"
1586
1586
  result.customer.credit_cards[0].verification.merchant_account_id == SpecHelper::NonDefaultMerchantAccountId
1587
1587
  end
@@ -1601,7 +1601,7 @@ describe Braintree::Customer do
1601
1601
  :options => {:verify_card => true, :verification_currency_iso_code => "GBP"}
1602
1602
  },
1603
1603
  )
1604
- result.success?.should == false
1604
+ expect(result.success?).to eq(false)
1605
1605
  expect(result.errors.for(:customer).for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code).to eq Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
1606
1606
 
1607
1607
  end
@@ -1621,7 +1621,7 @@ describe Braintree::Customer do
1621
1621
  :options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "GBP"}
1622
1622
  },
1623
1623
  )
1624
- result.success?.should == false
1624
+ expect(result.success?).to eq(false)
1625
1625
  expect(result.errors.for(:customer).for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code).to eq Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
1626
1626
 
1627
1627
  end
@@ -1679,9 +1679,9 @@ describe Braintree::Customer do
1679
1679
  :first_name => "Mr. Joe",
1680
1680
  :last_name => "Super Cool",
1681
1681
  )
1682
- updated_customer.first_name.should == "Mr. Joe"
1683
- updated_customer.last_name.should == "Super Cool"
1684
- updated_customer.updated_at.between?(Time.now - 60, Time.now).should == true
1682
+ expect(updated_customer.first_name).to eq("Mr. Joe")
1683
+ expect(updated_customer.last_name).to eq("Super Cool")
1684
+ expect(updated_customer.updated_at.between?(Time.now - 60, Time.now)).to eq(true)
1685
1685
  end
1686
1686
 
1687
1687
  it "raises an error if unsuccessful" do
@@ -1715,7 +1715,7 @@ describe Braintree::Customer do
1715
1715
 
1716
1716
  customer = Braintree::Customer.find(customer.id)
1717
1717
 
1718
- customer.default_payment_method.should == default_payment_method
1718
+ expect(customer.default_payment_method).to eq(default_payment_method)
1719
1719
  end
1720
1720
  end
1721
1721
 
@@ -1726,7 +1726,7 @@ describe Braintree::Customer do
1726
1726
  :payment_method_nonce => Braintree::Test::Nonce::PayPalBillingAgreement,
1727
1727
  )
1728
1728
 
1729
- result.should be_success
1729
+ expect(result).to be_success
1730
1730
  end
1731
1731
 
1732
1732
  it "updates a customer with a future paypal account" do
@@ -1754,8 +1754,8 @@ describe Braintree::Customer do
1754
1754
  :payment_method_nonce => nonce,
1755
1755
  )
1756
1756
 
1757
- result.should be_success
1758
- result.customer.default_payment_method.token.should == paypal_account_token
1757
+ expect(result).to be_success
1758
+ expect(result.customer.default_payment_method.token).to eq(paypal_account_token)
1759
1759
  end
1760
1760
  end
1761
1761
 
@@ -1792,7 +1792,7 @@ describe Braintree::Customer do
1792
1792
  },
1793
1793
  )
1794
1794
 
1795
- result.should be_success
1795
+ expect(result).to be_success
1796
1796
  end
1797
1797
 
1798
1798
  it "updates a customer with payment_method_nonce and paypal options" do
@@ -1838,8 +1838,8 @@ describe Braintree::Customer do
1838
1838
  },
1839
1839
  )
1840
1840
 
1841
- result.should be_success
1842
- result.customer.default_payment_method.token.should == paypal_account_token
1841
+ expect(result).to be_success
1842
+ expect(result.customer.default_payment_method.token).to eq(paypal_account_token)
1843
1843
  end
1844
1844
  end
1845
1845
 
@@ -1849,7 +1849,7 @@ describe Braintree::Customer do
1849
1849
  :payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
1850
1850
  )
1851
1851
 
1852
- result.should_not be_success
1852
+ expect(result).not_to be_success
1853
1853
  end
1854
1854
 
1855
1855
  it "does not update a customer with a onetime paypal account" do
@@ -1879,8 +1879,8 @@ describe Braintree::Customer do
1879
1879
  :payment_method_nonce => nonce,
1880
1880
  )
1881
1881
 
1882
- result.should_not be_success
1883
- customer.default_payment_method.token.should == credit_card_token
1882
+ expect(result).not_to be_success
1883
+ expect(customer.default_payment_method.token).to eq(credit_card_token)
1884
1884
  end
1885
1885
  end
1886
1886
  end