braintree 4.14.0 → 4.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (241) 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_search.rb +1 -1
  22. data/lib/braintree/customer.rb +5 -9
  23. data/lib/braintree/customer_gateway.rb +7 -7
  24. data/lib/braintree/customer_search.rb +1 -1
  25. data/lib/braintree/descriptor.rb +1 -1
  26. data/lib/braintree/digest.rb +1 -1
  27. data/lib/braintree/disbursement.rb +5 -5
  28. data/lib/braintree/discount_gateway.rb +1 -1
  29. data/lib/braintree/dispute/evidence.rb +1 -1
  30. data/lib/braintree/dispute/paypal_message.rb +1 -1
  31. data/lib/braintree/dispute/status_history.rb +1 -1
  32. data/lib/braintree/dispute/transaction.rb +1 -1
  33. data/lib/braintree/dispute/transaction_details.rb +1 -1
  34. data/lib/braintree/dispute.rb +3 -3
  35. data/lib/braintree/dispute_gateway.rb +1 -1
  36. data/lib/braintree/dispute_search.rb +1 -1
  37. data/lib/braintree/document_upload.rb +2 -2
  38. data/lib/braintree/document_upload_gateway.rb +3 -3
  39. data/lib/braintree/enriched_customer_data.rb +2 -2
  40. data/lib/braintree/error_result.rb +2 -3
  41. data/lib/braintree/errors.rb +3 -3
  42. data/lib/braintree/exceptions.rb +1 -2
  43. data/lib/braintree/exchange_rate.rb +2 -2
  44. data/lib/braintree/exchange_rate_quote.rb +3 -3
  45. data/lib/braintree/exchange_rate_quote_gateway.rb +1 -1
  46. data/lib/braintree/exchange_rate_quote_input.rb +3 -3
  47. data/lib/braintree/exchange_rate_quote_request.rb +3 -3
  48. data/lib/braintree/exchange_rate_quote_response.rb +3 -3
  49. data/lib/braintree/facilitated_details.rb +1 -1
  50. data/lib/braintree/facilitator_details.rb +1 -1
  51. data/lib/braintree/google_pay_card.rb +3 -3
  52. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  53. data/lib/braintree/graphql_client.rb +1 -1
  54. data/lib/braintree/http.rb +1 -1
  55. data/lib/braintree/local_payment_completed.rb +2 -2
  56. data/lib/braintree/local_payment_expired.rb +2 -2
  57. data/lib/braintree/local_payment_funded.rb +2 -2
  58. data/lib/braintree/local_payment_reversed.rb +2 -2
  59. data/lib/braintree/merchant.rb +3 -3
  60. data/lib/braintree/merchant_account.rb +2 -2
  61. data/lib/braintree/merchant_account_gateway.rb +9 -9
  62. data/lib/braintree/meta_checkout_card.rb +89 -0
  63. data/lib/braintree/meta_checkout_token.rb +88 -0
  64. data/lib/braintree/modification.rb +3 -3
  65. data/lib/braintree/oauth_credentials.rb +3 -3
  66. data/lib/braintree/paginated_collection.rb +2 -2
  67. data/lib/braintree/paginated_result.rb +1 -1
  68. data/lib/braintree/payment_instrument_type.rb +2 -0
  69. data/lib/braintree/payment_method_customer_data_updated_metadata.rb +2 -2
  70. data/lib/braintree/payment_method_gateway.rb +23 -10
  71. data/lib/braintree/payment_method_nonce.rb +4 -4
  72. data/lib/braintree/payment_method_nonce_details.rb +1 -1
  73. data/lib/braintree/payment_method_nonce_details_payer_info.rb +1 -1
  74. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  75. data/lib/braintree/paypal_account.rb +1 -2
  76. data/lib/braintree/paypal_account_gateway.rb +5 -5
  77. data/lib/braintree/plan.rb +1 -1
  78. data/lib/braintree/plan_gateway.rb +2 -2
  79. data/lib/braintree/resource_collection.rb +2 -2
  80. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  81. data/lib/braintree/risk_data.rb +1 -1
  82. data/lib/braintree/samsung_pay_card.rb +5 -5
  83. data/lib/braintree/sepa_direct_debit_account.rb +2 -2
  84. data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +1 -1
  85. data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
  86. data/lib/braintree/sha256_digest.rb +1 -1
  87. data/lib/braintree/subscription/status_details.rb +1 -1
  88. data/lib/braintree/subscription.rb +2 -2
  89. data/lib/braintree/subscription_gateway.rb +6 -6
  90. data/lib/braintree/subscription_search.rb +1 -1
  91. data/lib/braintree/successful_result.rb +2 -2
  92. data/lib/braintree/test/credit_card.rb +7 -10
  93. data/lib/braintree/test/merchant_account.rb +1 -1
  94. data/lib/braintree/test/nonce.rb +4 -0
  95. data/lib/braintree/test/transaction_amounts.rb +2 -3
  96. data/lib/braintree/test/venmo_sdk.rb +2 -0
  97. data/lib/braintree/testing_gateway.rb +1 -1
  98. data/lib/braintree/three_d_secure_info.rb +1 -1
  99. data/lib/braintree/transaction/address_details.rb +1 -1
  100. data/lib/braintree/transaction/credit_card_details.rb +4 -1
  101. data/lib/braintree/transaction/customer_details.rb +1 -1
  102. data/lib/braintree/transaction/disbursement_details.rb +1 -1
  103. data/lib/braintree/transaction/local_payment_details.rb +2 -0
  104. data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
  105. data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
  106. data/lib/braintree/transaction/samsung_pay_card_details.rb +1 -1
  107. data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +1 -1
  108. data/lib/braintree/transaction/status_details.rb +1 -1
  109. data/lib/braintree/transaction/subscription_details.rb +1 -1
  110. data/lib/braintree/transaction/us_bank_account_details.rb +1 -1
  111. data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
  112. data/lib/braintree/transaction.rb +27 -20
  113. data/lib/braintree/transaction_gateway.rb +23 -12
  114. data/lib/braintree/transaction_line_item.rb +2 -2
  115. data/lib/braintree/transaction_line_item_gateway.rb +1 -1
  116. data/lib/braintree/transaction_review.rb +1 -1
  117. data/lib/braintree/transaction_search.rb +7 -6
  118. data/lib/braintree/unknown_payment_method.rb +1 -1
  119. data/lib/braintree/us_bank_account.rb +2 -2
  120. data/lib/braintree/us_bank_account_verification.rb +23 -15
  121. data/lib/braintree/us_bank_account_verification_search.rb +1 -1
  122. data/lib/braintree/util.rb +3 -3
  123. data/lib/braintree/validation_error.rb +1 -1
  124. data/lib/braintree/validation_error_collection.rb +3 -3
  125. data/lib/braintree/venmo_account.rb +3 -3
  126. data/lib/braintree/venmo_profile_data.rb +6 -4
  127. data/lib/braintree/version.rb +1 -1
  128. data/lib/braintree/visa_checkout_card.rb +7 -7
  129. data/lib/braintree/webhook_notification.rb +3 -2
  130. data/lib/braintree/webhook_notification_gateway.rb +3 -3
  131. data/lib/braintree/webhook_testing.rb +1 -1
  132. data/lib/braintree/webhook_testing_gateway.rb +18 -1
  133. data/lib/braintree/xml/generator.rb +1 -1
  134. data/lib/braintree/xml/libxml.rb +1 -1
  135. data/lib/braintree/xml/parser.rb +2 -2
  136. data/lib/braintree/xml/rexml.rb +2 -2
  137. data/lib/braintree/xml.rb +1 -1
  138. data/lib/braintree.rb +4 -1
  139. data/spec/integration/braintree/add_on_spec.rb +9 -9
  140. data/spec/integration/braintree/address_spec.rb +69 -69
  141. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  142. data/spec/integration/braintree/apple_pay_spec.rb +8 -8
  143. data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
  144. data/spec/integration/braintree/credit_card_spec.rb +223 -223
  145. data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
  146. data/spec/integration/braintree/credit_card_verification_spec.rb +52 -52
  147. data/spec/integration/braintree/customer_search_spec.rb +20 -20
  148. data/spec/integration/braintree/customer_spec.rb +313 -313
  149. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  150. data/spec/integration/braintree/discount_spec.rb +9 -9
  151. data/spec/integration/braintree/dispute_search_spec.rb +0 -1
  152. data/spec/integration/braintree/dispute_spec.rb +87 -87
  153. data/spec/integration/braintree/document_upload_spec.rb +17 -17
  154. data/spec/integration/braintree/error_codes_spec.rb +2 -2
  155. data/spec/integration/braintree/http_spec.rb +28 -28
  156. data/spec/integration/braintree/merchant_account_spec.rb +127 -127
  157. data/spec/integration/braintree/merchant_spec.rb +103 -103
  158. data/spec/integration/braintree/oauth_spec.rb +61 -61
  159. data/spec/integration/braintree/payment_method_nonce_spec.rb +89 -69
  160. data/spec/integration/braintree/payment_method_spec.rb +389 -389
  161. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +150 -78
  162. data/spec/integration/braintree/paypal_account_spec.rb +38 -38
  163. data/spec/integration/braintree/plan_spec.rb +15 -15
  164. data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
  165. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
  166. data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
  167. data/spec/integration/braintree/subscription_spec.rb +364 -364
  168. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  169. data/spec/integration/braintree/test_transaction_spec.rb +19 -19
  170. data/spec/integration/braintree/transaction_line_item_spec.rb +6 -6
  171. data/spec/integration/braintree/transaction_search_spec.rb +225 -165
  172. data/spec/integration/braintree/transaction_spec.rb +1502 -1210
  173. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
  174. data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
  175. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
  176. data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
  177. data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
  178. data/spec/spec_helper.rb +9 -8
  179. data/spec/unit/braintree/address_spec.rb +8 -8
  180. data/spec/unit/braintree/base_module_spec.rb +4 -4
  181. data/spec/unit/braintree/client_token_spec.rb +2 -2
  182. data/spec/unit/braintree/configuration_spec.rb +57 -57
  183. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  184. data/spec/unit/braintree/credit_card_spec.rb +31 -29
  185. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +28 -28
  186. data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
  187. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
  188. data/spec/unit/braintree/customer_spec.rb +41 -40
  189. data/spec/unit/braintree/digest_spec.rb +5 -5
  190. data/spec/unit/braintree/disbursement_spec.rb +11 -11
  191. data/spec/unit/braintree/dispute_search_spec.rb +2 -2
  192. data/spec/unit/braintree/dispute_spec.rb +56 -56
  193. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  194. data/spec/unit/braintree/enriched_customer_data_spec.rb +11 -2
  195. data/spec/unit/braintree/error_result_spec.rb +5 -5
  196. data/spec/unit/braintree/errors_spec.rb +9 -9
  197. data/spec/unit/braintree/http_spec.rb +9 -9
  198. data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
  199. data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
  200. data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
  201. data/spec/unit/braintree/merchant_account_spec.rb +4 -4
  202. data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
  203. data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
  204. data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
  205. data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
  206. data/spec/unit/braintree/modification_spec.rb +1 -1
  207. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
  208. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
  209. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
  210. data/spec/unit/braintree/payment_method_spec.rb +19 -19
  211. data/spec/unit/braintree/paypal_account_spec.rb +4 -4
  212. data/spec/unit/braintree/resource_collection_spec.rb +7 -7
  213. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
  214. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  215. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  216. data/spec/unit/braintree/subscription_search_spec.rb +17 -17
  217. data/spec/unit/braintree/subscription_spec.rb +8 -8
  218. data/spec/unit/braintree/successful_result_spec.rb +5 -5
  219. data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
  220. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
  221. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  222. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  223. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
  224. data/spec/unit/braintree/transaction_gateway_spec.rb +39 -7
  225. data/spec/unit/braintree/transaction_search_spec.rb +2 -2
  226. data/spec/unit/braintree/transaction_spec.rb +101 -93
  227. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  228. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  229. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  230. data/spec/unit/braintree/us_bank_account_verification_spec.rb +12 -7
  231. data/spec/unit/braintree/util_spec.rb +27 -27
  232. data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
  233. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  234. data/spec/unit/braintree/venmo_profile_data_spec.rb +16 -5
  235. data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
  236. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  237. data/spec/unit/braintree/xml/parser_spec.rb +8 -8
  238. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  239. data/spec/unit/braintree/xml_spec.rb +17 -17
  240. data/spec/unit/braintree_spec.rb +2 -2
  241. metadata +11 -2
@@ -6,18 +6,18 @@ describe Braintree::Util do
6
6
  original = {"a" => "b", "c" => "d"}
7
7
  new = Braintree::Util.symbolize_keys(original)
8
8
 
9
- original["a"].should == "b"
10
- new[:a].should == "b"
9
+ expect(original["a"]).to eq("b")
10
+ expect(new[:a]).to eq("b")
11
11
  end
12
12
 
13
13
  it "symbolizes nested keys" do
14
14
  hash = {"a" => {"b" => {"c" => "d"}}}
15
- Braintree::Util.symbolize_keys(hash).should == {:a => {:b => {:c => "d"}}}
15
+ expect(Braintree::Util.symbolize_keys(hash)).to eq({:a => {:b => {:c => "d"}}})
16
16
  end
17
17
 
18
18
  it "symbolizes nested keys in arrays" do
19
19
  hash = {"a" => ["b" => {"c" => "d"}]}
20
- Braintree::Util.symbolize_keys(hash).should == {:a => [:b => {:c => "d"}]}
20
+ expect(Braintree::Util.symbolize_keys(hash)).to eq({:a => [:b => {:c => "d"}]})
21
21
  end
22
22
  end
23
23
 
@@ -173,41 +173,41 @@ describe Braintree::Util do
173
173
 
174
174
  describe "self.replace_key" do
175
175
  it "replaces the target key with the replacement key" do
176
- Braintree::Util.replace_key(
176
+ expect(Braintree::Util.replace_key(
177
177
  {:a => {:b => "some value"}},
178
178
  :b,
179
- :c).should == {:a => {:c => "some value"}}
179
+ :c)).to eq({:a => {:c => "some value"}})
180
180
  end
181
181
 
182
182
  it "returns hash with all of the original keys if the target key does not exist" do
183
- Braintree::Util.replace_key(
183
+ expect(Braintree::Util.replace_key(
184
184
  {:some_key => "some value"},
185
185
  :not_found,
186
- :new_key).should == {:some_key => "some value"}
186
+ :new_key)).to eq({:some_key => "some value"})
187
187
  end
188
188
  end
189
189
 
190
190
  describe "self._flatten_hash_keys" do
191
191
  it "flattens hash keys" do
192
- Braintree::Util._flatten_hash_keys(:nested => {
192
+ expect(Braintree::Util._flatten_hash_keys(:nested => {
193
193
  :nested_allowed => "ok",
194
194
  :nested_allowed2 => "also ok",
195
195
  :nested_invalid => "bad"
196
- }).should == ["nested[nested_allowed2]", "nested[nested_allowed]", "nested[nested_invalid]"]
196
+ })).to eq(["nested[nested_allowed2]", "nested[nested_allowed]", "nested[nested_invalid]"])
197
197
  end
198
198
  end
199
199
 
200
200
  describe "self._flatten_valid_keys" do
201
201
  it "flattens hash keys" do
202
- Braintree::Util._flatten_valid_keys(
202
+ expect(Braintree::Util._flatten_valid_keys(
203
203
  [:top_level, {:nested => [:nested_allowed, :nested_allowed2]}],
204
- ).should == ["nested[nested_allowed2]", "nested[nested_allowed]", "top_level"]
204
+ )).to eq(["nested[nested_allowed2]", "nested[nested_allowed]", "top_level"])
205
205
  end
206
206
 
207
207
  it "allows wildcards with the :_any_key_ symbol" do
208
- Braintree::Util._flatten_valid_keys(
208
+ expect(Braintree::Util._flatten_valid_keys(
209
209
  [:top_level, {:nested => :_any_key_}],
210
- ).should == ["nested[_any_key_]", "top_level"]
210
+ )).to eq(["nested[_any_key_]", "top_level"])
211
211
  end
212
212
  end
213
213
 
@@ -215,25 +215,25 @@ describe Braintree::Util do
215
215
  it "deletes the attribute from the hash" do
216
216
  hash = {:foo => ["x"], :bar => :baz}
217
217
  Braintree::Util.extract_attribute_as_array(hash, :foo)
218
- hash.should == {:bar => :baz}
218
+ expect(hash).to eq({:bar => :baz})
219
219
  end
220
220
 
221
221
  it "puts the attribute in an array if it's not an array" do
222
222
  hash = {:foo => "x", :bar => :baz}
223
223
  result = Braintree::Util.extract_attribute_as_array(hash, :foo)
224
- result.should == ["x"]
224
+ expect(result).to eq(["x"])
225
225
  end
226
226
 
227
227
  it "returns the value if it's already an array" do
228
228
  hash = {:foo => ["one", "two"], :bar => :baz}
229
229
  result = Braintree::Util.extract_attribute_as_array(hash, :foo)
230
- result.should == ["one", "two"]
230
+ expect(result).to eq(["one", "two"])
231
231
  end
232
232
 
233
233
  it "returns empty array if the attribute is not in the hash" do
234
234
  hash = {:foo => ["one", "two"], :bar => :baz}
235
235
  result = Braintree::Util.extract_attribute_as_array(hash, :quz)
236
- result.should == []
236
+ expect(result).to eq([])
237
237
  end
238
238
 
239
239
  it "raises an UnexpectedError if nil data is provided" do
@@ -246,24 +246,24 @@ describe Braintree::Util do
246
246
  describe "self.hash_to_query_string" do
247
247
  it "generates a query string from the hash" do
248
248
  hash = {:foo => {:key_one => "value_one", :key_two => "value_two"}}
249
- Braintree::Util.hash_to_query_string(hash).should == "foo%5Bkey_one%5D=value_one&foo%5Bkey_two%5D=value_two"
249
+ expect(Braintree::Util.hash_to_query_string(hash)).to eq("foo%5Bkey_one%5D=value_one&foo%5Bkey_two%5D=value_two")
250
250
  end
251
251
 
252
252
  it "works for nesting 2 levels deep" do
253
253
  hash = {:foo => {:nested => {:key_one => "value_one", :key_two => "value_two"}}}
254
- Braintree::Util.hash_to_query_string(hash).should == "foo%5Bnested%5D%5Bkey_one%5D=value_one&foo%5Bnested%5D%5Bkey_two%5D=value_two"
254
+ expect(Braintree::Util.hash_to_query_string(hash)).to eq("foo%5Bnested%5D%5Bkey_one%5D=value_one&foo%5Bnested%5D%5Bkey_two%5D=value_two")
255
255
  end
256
256
  end
257
257
 
258
258
  describe "self.parse_query_string" do
259
259
  it "parses the query string" do
260
260
  query_string = "foo=bar%20baz&hash=a1b2c3"
261
- Braintree::Util.parse_query_string(query_string).should == {:foo => "bar baz", :hash => "a1b2c3"}
261
+ expect(Braintree::Util.parse_query_string(query_string)).to eq({:foo => "bar baz", :hash => "a1b2c3"})
262
262
  end
263
263
 
264
264
  it "parses the query string when a key has an empty value" do
265
265
  query_string = "foo=bar%20baz&hash=a1b2c3&vat_number="
266
- Braintree::Util.parse_query_string(query_string).should == {:foo => "bar baz", :hash => "a1b2c3", :vat_number => ""}
266
+ expect(Braintree::Util.parse_query_string(query_string)).to eq({:foo => "bar baz", :hash => "a1b2c3", :vat_number => ""})
267
267
  end
268
268
  end
269
269
 
@@ -388,15 +388,15 @@ describe Braintree::Util do
388
388
 
389
389
  describe "self.to_big_decimal" do
390
390
  it "returns the BigDecimal when given a BigDecimal" do
391
- Braintree::Util.to_big_decimal(BigDecimal("12.34")).should == BigDecimal("12.34")
391
+ expect(Braintree::Util.to_big_decimal(BigDecimal("12.34"))).to eq(BigDecimal("12.34"))
392
392
  end
393
393
 
394
394
  it "returns a BigDecimal when given a string" do
395
- Braintree::Util.to_big_decimal("12.34").should == BigDecimal("12.34")
395
+ expect(Braintree::Util.to_big_decimal("12.34")).to eq(BigDecimal("12.34"))
396
396
  end
397
397
 
398
398
  it "returns nil when given nil" do
399
- Braintree::Util.to_big_decimal(nil).should be_nil
399
+ expect(Braintree::Util.to_big_decimal(nil)).to be_nil
400
400
  end
401
401
 
402
402
  it "blows up when not given a String or BigDecimal" do
@@ -408,13 +408,13 @@ describe Braintree::Util do
408
408
 
409
409
  describe "self.url_encode" do
410
410
  it "url encodes the given text" do
411
- Braintree::Util.url_encode("foo?bar").should == "foo%3Fbar"
411
+ expect(Braintree::Util.url_encode("foo?bar")).to eq("foo%3Fbar")
412
412
  end
413
413
  end
414
414
 
415
415
  describe "self.url_decode" do
416
416
  it "url decodes the given text" do
417
- Braintree::Util.url_decode("foo%3Fbar").should == "foo?bar"
417
+ expect(Braintree::Util.url_decode("foo%3Fbar")).to eq("foo?bar")
418
418
  end
419
419
  end
420
420
  end
@@ -8,9 +8,9 @@ describe Braintree::ValidationErrorCollection do
8
8
  hash = {:errors => [{:attribute => "some model attribute", :code => 1, :message => "bad juju"}]}
9
9
  collection = Braintree::ValidationErrorCollection.new(hash)
10
10
  error = collection[0]
11
- error.attribute.should == "some model attribute"
12
- error.code.should == 1
13
- error.message.should == "bad juju"
11
+ expect(error.attribute).to eq("some model attribute")
12
+ expect(error.code).to eq(1)
13
+ expect(error.message).to eq("bad juju")
14
14
  end
15
15
  end
16
16
 
@@ -23,9 +23,9 @@ describe Braintree::ValidationErrorCollection do
23
23
  }
24
24
  }
25
25
  errors = Braintree::ValidationErrorCollection.new(hash)
26
- errors.for(:nested).on(:number)[0].code.should == 2
27
- errors.for(:nested).on(:number)[0].message.should == "badder juju"
28
- errors.for(:nested).on(:number)[0].attribute.should == "number"
26
+ expect(errors.for(:nested).on(:number)[0].code).to eq(2)
27
+ expect(errors.for(:nested).on(:number)[0].message).to eq("badder juju")
28
+ expect(errors.for(:nested).on(:number)[0].attribute).to eq("number")
29
29
  end
30
30
  end
31
31
 
@@ -35,7 +35,7 @@ describe Braintree::ValidationErrorCollection do
35
35
  {:attribute => "name", :code => "code1", :message => "message1"},
36
36
  {:attribute => "name", :code => "code2", :message => "message2"}
37
37
  ])
38
- errors.inspect.should == "#<Braintree::ValidationErrorCollection errors:[(code1) message1, (code2) message2]>"
38
+ expect(errors.inspect).to eq("#<Braintree::ValidationErrorCollection errors:[(code1) message1, (code2) message2]>")
39
39
  end
40
40
 
41
41
  it "shows errors 1 level deep" do
@@ -47,7 +47,7 @@ describe Braintree::ValidationErrorCollection do
47
47
  :errors => [{:attribute => "name", :code => "code2", :message => "message2"}]
48
48
  },
49
49
  )
50
- errors.inspect.should == "#<Braintree::ValidationErrorCollection errors:[(code1) message1], level1:[(code2) message2]>"
50
+ expect(errors.inspect).to eq("#<Braintree::ValidationErrorCollection errors:[(code1) message1], level1:[(code2) message2]>")
51
51
  end
52
52
 
53
53
  it "shows errors 2 levels deep" do
@@ -62,7 +62,7 @@ describe Braintree::ValidationErrorCollection do
62
62
  }
63
63
  },
64
64
  )
65
- errors.inspect.should == "#<Braintree::ValidationErrorCollection errors:[(code1) message1], level1:[(code2) message2], level1/level2:[(code3) message3]>"
65
+ expect(errors.inspect).to eq("#<Braintree::ValidationErrorCollection errors:[(code1) message1], level1:[(code2) message2], level1/level2:[(code3) message3]>")
66
66
  end
67
67
  end
68
68
 
@@ -73,16 +73,16 @@ describe Braintree::ValidationErrorCollection do
73
73
  {:attribute => "name", :code => 2, :message => "contains invalid chars"},
74
74
  {:attribute => "not name", :code => 3, :message => "is invalid"}
75
75
  ])
76
- errors.on("name").size.should == 2
77
- errors.on("name").map { |e| e.code }.should == [1, 2]
76
+ expect(errors.on("name").size).to eq(2)
77
+ expect(errors.on("name").map { |e| e.code }).to eq([1, 2])
78
78
  end
79
79
 
80
80
  it "has indifferent access" do
81
81
  errors = Braintree::ValidationErrorCollection.new(:errors => [
82
82
  {:attribute => "name", :code => 3, :message => "is too long"},
83
83
  ])
84
- errors.on(:name).size.should == 1
85
- errors.on(:name)[0].code.should == 3
84
+ expect(errors.on(:name).size).to eq(1)
85
+ expect(errors.on(:name)[0].code).to eq(3)
86
86
 
87
87
  end
88
88
  end
@@ -94,7 +94,7 @@ describe Braintree::ValidationErrorCollection do
94
94
  {:attribute => "two", :code => 2, :message => "contains invalid chars"},
95
95
  {:attribute => "thr", :code => 3, :message => "is invalid"}
96
96
  ])
97
- errors.deep_size.should == 3
97
+ expect(errors.deep_size).to eq(3)
98
98
  end
99
99
 
100
100
  it "returns the size of nested errors as well" do
@@ -104,7 +104,7 @@ describe Braintree::ValidationErrorCollection do
104
104
  :errors => [{:attribute => "number", :code => 2, :message => "badder juju"}]
105
105
  },
106
106
  )
107
- errors.deep_size.should == 2
107
+ expect(errors.deep_size).to eq(2)
108
108
  end
109
109
 
110
110
  it "returns the size of multiple nestings of errors" do
@@ -122,7 +122,7 @@ describe Braintree::ValidationErrorCollection do
122
122
  :errors => [{:attribute => "five", :code => 2, :message => "badder juju"}],
123
123
  },
124
124
  )
125
- errors.deep_size.should == 5
125
+ expect(errors.deep_size).to eq(5)
126
126
  end
127
127
  end
128
128
 
@@ -142,7 +142,7 @@ describe Braintree::ValidationErrorCollection do
142
142
  :errors => [{:attribute => "five", :code => 5, :message => "badder juju"}],
143
143
  },
144
144
  )
145
- errors.deep_errors.map { |e| e.code }.sort.should == [1, 2, 3, 4, 5]
145
+ expect(errors.deep_errors.map { |e| e.code }.sort).to eq([1, 2, 3, 4, 5])
146
146
  end
147
147
  end
148
148
 
@@ -159,8 +159,8 @@ describe Braintree::ValidationErrorCollection do
159
159
  }
160
160
  },
161
161
  )
162
- errors.shallow_errors.map { |e| e.code }.should == [1, 2]
163
- errors.for(:nested).shallow_errors.map { |e| e.code }.should == [3]
162
+ expect(errors.shallow_errors.map { |e| e.code }).to eq([1, 2])
163
+ expect(errors.for(:nested).shallow_errors.map { |e| e.code }).to eq([3])
164
164
  end
165
165
 
166
166
  it "returns an clone of the real array" do
@@ -170,7 +170,7 @@ describe Braintree::ValidationErrorCollection do
170
170
  {:attribute => "two", :code => 2, :message => "bad juju"}],
171
171
  )
172
172
  errors.shallow_errors.pop
173
- errors.shallow_errors.map { |e| e.code }.should == [1, 2]
173
+ expect(errors.shallow_errors.map { |e| e.code }).to eq([1, 2])
174
174
  end
175
175
  end
176
176
  end
@@ -186,9 +186,9 @@ describe Braintree::ValidationErrorCollection do
186
186
  }]}
187
187
  collection = Braintree::ValidationErrorCollection.new(hash)
188
188
  error = collection[0]
189
- error.attribute.should == "two"
190
- error.code.should == 1
191
- error.message.should == "bad juju"
189
+ expect(error.attribute).to eq("two")
190
+ expect(error.code).to eq(1)
191
+ expect(error.message).to eq("bad juju")
192
192
  !error.respond_to? :untracked_param
193
193
  end
194
194
  end
@@ -210,9 +210,9 @@ describe Braintree::ValidationErrorCollection do
210
210
  }
211
211
  }
212
212
  errors = Braintree::ValidationErrorCollection.new(hash)
213
- errors.for(:nested).on(:nested_attribute)[0].code.should == 2
214
- errors.for(:nested).on(:nested_attribute)[0].message.should == "badder juju"
215
- errors.for(:nested).on(:nested_attribute)[0].attribute.should == "nested_attribute"
213
+ expect(errors.for(:nested).on(:nested_attribute)[0].code).to eq(2)
214
+ expect(errors.for(:nested).on(:nested_attribute)[0].message).to eq("badder juju")
215
+ expect(errors.for(:nested).on(:nested_attribute)[0].attribute).to eq("nested_attribute")
216
216
  end
217
217
  end
218
218
 
@@ -234,7 +234,7 @@ describe Braintree::ValidationErrorCollection do
234
234
  }],
235
235
  }
236
236
  errors = Braintree::ValidationErrorCollection.new(hash)
237
- errors.deep_size.should == 3
237
+ expect(errors.deep_size).to eq(3)
238
238
  end
239
239
 
240
240
  it "returns the size of nested errors as well" do
@@ -253,7 +253,7 @@ describe Braintree::ValidationErrorCollection do
253
253
  }
254
254
  }
255
255
  errors = Braintree::ValidationErrorCollection.new(hash)
256
- errors.deep_size.should == 2
256
+ expect(errors.deep_size).to eq(2)
257
257
  end
258
258
 
259
259
  it "returns the size of multiple nestings of errors" do
@@ -290,7 +290,7 @@ describe Braintree::ValidationErrorCollection do
290
290
  }
291
291
  }
292
292
  errors = Braintree::ValidationErrorCollection.new(hash)
293
- errors.deep_size.should == 5
293
+ expect(errors.deep_size).to eq(5)
294
294
  end
295
295
  end
296
296
 
@@ -329,7 +329,7 @@ describe Braintree::ValidationErrorCollection do
329
329
  }
330
330
  }
331
331
  errors = Braintree::ValidationErrorCollection.new(hash)
332
- errors.deep_errors.map { |e| e.code }.sort.should == [1, 2, 3, 4, 5]
332
+ expect(errors.deep_errors.map { |e| e.code }.sort).to eq([1, 2, 3, 4, 5])
333
333
  end
334
334
  end
335
335
 
@@ -368,10 +368,10 @@ describe Braintree::ValidationErrorCollection do
368
368
  }
369
369
  }
370
370
  errors = Braintree::ValidationErrorCollection.new(hash)
371
- errors.shallow_errors.map { |e| e.code }.should == [1]
372
- errors.for(:nested).shallow_errors.map { |e| e.code }.should == [2,3]
373
- errors.for(:nested).for(:deeply_nested).shallow_errors.map { |e| e.code }.should == [4]
374
- errors.for(:nested_again).shallow_errors.map { |e| e.code }.should == [5]
371
+ expect(errors.shallow_errors.map { |e| e.code }).to eq([1])
372
+ expect(errors.for(:nested).shallow_errors.map { |e| e.code }).to eq([2,3])
373
+ expect(errors.for(:nested).for(:deeply_nested).shallow_errors.map { |e| e.code }).to eq([4])
374
+ expect(errors.for(:nested_again).shallow_errors.map { |e| e.code }).to eq([5])
375
375
  end
376
376
  end
377
377
  end
@@ -4,16 +4,16 @@ describe Braintree::ValidationError do
4
4
  describe "initialize" do
5
5
  it "works" do
6
6
  error = Braintree::ValidationError.new :attribute => "some model attribute", :code => 1, :message => "bad juju"
7
- error.attribute.should == "some model attribute"
8
- error.code.should == 1
9
- error.message.should == "bad juju"
7
+ expect(error.attribute).to eq("some model attribute")
8
+ expect(error.code).to eq(1)
9
+ expect(error.message).to eq("bad juju")
10
10
  end
11
11
  end
12
12
 
13
13
  describe "inspect" do
14
14
  it "is pretty" do
15
15
  error = Braintree::ValidationError.new :attribute => "number", :code => "123456", :message => "Number is bad juju."
16
- error.inspect.should == "#<Braintree::ValidationError (123456) Number is bad juju.>"
16
+ expect(error.inspect).to eq("#<Braintree::ValidationError (123456) Number is bad juju.>")
17
17
  end
18
18
  end
19
19
  end
@@ -12,21 +12,32 @@ describe Braintree::VenmoProfileData do
12
12
  describe "self._new" do
13
13
  it "initializes the object with the appropriate attributes set" do
14
14
 
15
+ address = {
16
+ street_address: "a-street-address",
17
+ extended_address: "an-extended-address",
18
+ locality: "a-locality",
19
+ region: "a-region",
20
+ postal_code: "a-postal-code"
21
+ }
15
22
  params = {
16
23
  username: "a-username",
17
24
  first_name: "a-first-name",
18
25
  last_name: "a-last-name",
19
26
  phone_number: "12312312343",
20
27
  email: "a-email",
28
+ billing_address: address,
29
+ shipping_address: address
21
30
  }
22
31
 
23
32
  payment_method_customer_data_updated = Braintree::VenmoProfileData._new(params)
24
33
 
25
- payment_method_customer_data_updated.username.should eq("a-username")
26
- payment_method_customer_data_updated.first_name.should eq("a-first-name")
27
- payment_method_customer_data_updated.last_name.should eq("a-last-name")
28
- payment_method_customer_data_updated.phone_number.should eq("12312312343")
29
- payment_method_customer_data_updated.email.should eq("a-email")
34
+ expect(payment_method_customer_data_updated.username).to eq("a-username")
35
+ expect(payment_method_customer_data_updated.first_name).to eq("a-first-name")
36
+ expect(payment_method_customer_data_updated.last_name).to eq("a-last-name")
37
+ expect(payment_method_customer_data_updated.phone_number).to eq("12312312343")
38
+ expect(payment_method_customer_data_updated.email).to eq("a-email")
39
+ expect(payment_method_customer_data_updated.billing_address).to eq(address)
40
+ expect(payment_method_customer_data_updated.shipping_address).to eq(address)
30
41
  end
31
42
  end
32
43
  end