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
@@ -34,7 +34,7 @@ describe Braintree::Http do
34
34
  Braintree::Configuration.logger.level = Logger::INFO
35
35
  Braintree::Customer.all
36
36
  utc_or_gmt = Time.now.utc.strftime("%Z")
37
- output.string.should include("[Braintree] [10/Oct/2009 13:55:36 #{utc_or_gmt}] POST /merchants/integration_merchant_id/customers/advanced_search_ids 200")
37
+ expect(output.string).to include("[Braintree] [10/Oct/2009 13:55:36 #{utc_or_gmt}] POST /merchants/integration_merchant_id/customers/advanced_search_ids 200")
38
38
  end
39
39
  ensure
40
40
  Braintree::Configuration.logger = old_logger
@@ -56,13 +56,13 @@ describe Braintree::Http do
56
56
  :number => Braintree::Test::CreditCardNumbers::Visa,
57
57
  :expiration_date => "05/2009",
58
58
  )
59
- result.success?.should == true
59
+ expect(result.success?).to eq(true)
60
60
  utc_or_gmt = Time.now.utc.strftime("%Z")
61
- output.string.should include("[Braintree] [10/Oct/2009 13:55:36 #{utc_or_gmt}] POST /merchants/integration_merchant_id/payment_methods")
62
- output.string.should include("[Braintree] <cardholder-name>Sam Jones</cardholder-name>")
63
- output.string.should include("[Braintree] <number>401288******1881</number>")
64
- output.string.should include("[Braintree] [10/Oct/2009 13:55:36 #{utc_or_gmt}] 201 Created")
65
- output.string.should match(/\[Braintree\] <token>\w+<\/token>/)
61
+ expect(output.string).to include("[Braintree] [10/Oct/2009 13:55:36 #{utc_or_gmt}] POST /merchants/integration_merchant_id/payment_methods")
62
+ expect(output.string).to include("[Braintree] <cardholder-name>Sam Jones</cardholder-name>")
63
+ expect(output.string).to include("[Braintree] <number>401288******1881</number>")
64
+ expect(output.string).to include("[Braintree] [10/Oct/2009 13:55:36 #{utc_or_gmt}] 201 Created")
65
+ expect(output.string).to match(/\[Braintree\] <token>\w+<\/token>/)
66
66
  end
67
67
  ensure
68
68
  Braintree::Configuration.logger = old_logger
@@ -73,8 +73,8 @@ describe Braintree::Http do
73
73
  config = Braintree::Configuration.instantiate
74
74
  file = File.new("#{File.dirname(__FILE__)}/../../fixtures/files/bt_logo.png", "r")
75
75
  response = config.http.post("#{config.base_merchant_path}/document_uploads", {"document_upload[kind]" => "evidence_document"}, file)
76
- response[:document_upload][:content_type].should == "image/png"
77
- response[:document_upload][:id].should_not be_nil
76
+ expect(response[:document_upload][:content_type]).to eq("image/png")
77
+ expect(response[:document_upload][:id]).not_to be_nil
78
78
  end
79
79
 
80
80
  describe "user_agent" do
@@ -85,14 +85,14 @@ describe Braintree::Http do
85
85
  it "sets the User-Agent header using the default user agent" do
86
86
  config = Braintree::Configuration.instantiate
87
87
  response = config.http.get("#{config.base_merchant_path}/test/headers")
88
- response[:headers][:HTTP_USER_AGENT].should == "Braintree Ruby Gem #{Braintree::Version::String}"
88
+ expect(response[:headers][:HTTP_USER_AGENT]).to eq("Braintree Ruby Gem #{Braintree::Version::String}")
89
89
  end
90
90
 
91
91
  it "sets the User-Agent header using a customer user agent" do
92
92
  Braintree::Configuration.custom_user_agent = "ActiveMerchant 1.2.3"
93
93
  config = Braintree::Configuration.instantiate
94
94
  response = config.http.get("#{config.base_merchant_path}/test/headers")
95
- response[:headers][:HTTP_USER_AGENT].should == "Braintree Ruby Gem #{Braintree::Version::String} (ActiveMerchant 1.2.3)"
95
+ expect(response[:headers][:HTTP_USER_AGENT]).to eq("Braintree Ruby Gem #{Braintree::Version::String} (ActiveMerchant 1.2.3)")
96
96
  end
97
97
  end
98
98
 
@@ -102,7 +102,7 @@ describe Braintree::Http do
102
102
  original_env = Braintree::Configuration.environment
103
103
  Braintree::Configuration.environment = :sandbox
104
104
  Braintree::Configuration.ssl_version = :TLSv1
105
- Braintree::Configuration.stub(:base_merchant_path).and_return("/")
105
+ allow(Braintree::Configuration).to receive(:base_merchant_path).and_return("/")
106
106
 
107
107
  expect do
108
108
  Braintree::Configuration.instantiate.http._http_do(Net::HTTP::Get, "/login")
@@ -118,7 +118,7 @@ describe Braintree::Http do
118
118
  original_env = Braintree::Configuration.environment
119
119
  Braintree::Configuration.environment = :sandbox
120
120
  Braintree::Configuration.ssl_version = :TLSv1_2
121
- Braintree::Configuration.stub(:base_merchant_path).and_return("/")
121
+ allow(Braintree::Configuration).to receive(:base_merchant_path).and_return("/")
122
122
 
123
123
  expect do
124
124
  Braintree::Configuration.instantiate.http._http_do(Net::HTTP::Get, "/login")
@@ -136,8 +136,8 @@ describe Braintree::Http do
136
136
  original_env = Braintree::Configuration.environment
137
137
  Braintree::Configuration.environment = :development
138
138
  config = Braintree::Configuration.instantiate
139
- config.stub(:ssl?).and_return(true)
140
- config.stub(:port).and_return(SSL_TEST_PORT)
139
+ allow(config).to receive(:ssl?).and_return(true)
140
+ allow(config).to receive(:port).and_return(SSL_TEST_PORT)
141
141
 
142
142
  start_ssl_server do
143
143
  expect do
@@ -155,11 +155,11 @@ describe Braintree::Http do
155
155
  Braintree::Configuration.environment = :development
156
156
  # Random CA root file from a different certificate authority
157
157
  config = Braintree::Configuration.instantiate
158
- config.stub(:ca_file).and_return(
158
+ allow(config).to receive(:ca_file).and_return(
159
159
  File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "ssl", "geotrust_global.crt")),
160
160
  )
161
- config.stub(:ssl?).and_return(true)
162
- config.stub(:port).and_return(SSL_TEST_PORT)
161
+ allow(config).to receive(:ssl?).and_return(true)
162
+ allow(config).to receive(:port).and_return(SSL_TEST_PORT)
163
163
 
164
164
  start_ssl_server do
165
165
  expect do
@@ -175,7 +175,7 @@ describe Braintree::Http do
175
175
  begin
176
176
  original_env = Braintree::Configuration.environment
177
177
  Braintree::Configuration.environment = :qa
178
- Braintree::Configuration.stub(:base_merchant_path).and_return("/")
178
+ allow(Braintree::Configuration).to receive(:base_merchant_path).and_return("/")
179
179
 
180
180
  expect do
181
181
  Braintree::Configuration.instantiate.http._http_do(Net::HTTP::Get, "/login")
@@ -189,7 +189,7 @@ describe Braintree::Http do
189
189
  begin
190
190
  original_env = Braintree::Configuration.environment
191
191
  Braintree::Configuration.environment = :sandbox
192
- Braintree::Configuration.stub(:base_merchant_path).and_return("/")
192
+ allow(Braintree::Configuration).to receive(:base_merchant_path).and_return("/")
193
193
 
194
194
  expect do
195
195
  Braintree::Configuration.instantiate.http._http_do(Net::HTTP::Get, "/login")
@@ -203,7 +203,7 @@ describe Braintree::Http do
203
203
  begin
204
204
  original_env = Braintree::Configuration.environment
205
205
  Braintree::Configuration.environment = :production
206
- Braintree::Configuration.stub(:base_merchant_path).and_return("/")
206
+ allow(Braintree::Configuration).to receive(:base_merchant_path).and_return("/")
207
207
 
208
208
  expect do
209
209
  Braintree::Configuration.instantiate.http._http_do(Net::HTTP::Get, "/login")
@@ -218,8 +218,8 @@ describe Braintree::Http do
218
218
  original_env = Braintree::Configuration.environment
219
219
  Braintree::Configuration.environment = :sandbox
220
220
  config = Braintree::Configuration.instantiate
221
- config.stub(:base_merchant_path).and_return("/")
222
- config.stub(:ca_file).and_return("does_not_exist")
221
+ allow(config).to receive(:base_merchant_path).and_return("/")
222
+ allow(config).to receive(:ca_file).and_return("does_not_exist")
223
223
 
224
224
  expect do
225
225
  config.http._http_do(Net::HTTP::Get, "/login")
@@ -234,13 +234,13 @@ describe Braintree::Http do
234
234
  describe "self._verify_ssl_certificate" do
235
235
  it "is false if preverify is false" do
236
236
  context = OpenSSL::X509::StoreContext.new(OpenSSL::X509::Store.new)
237
- Braintree::Configuration.instantiate.http._verify_ssl_certificate(false, context).should == false
237
+ expect(Braintree::Configuration.instantiate.http._verify_ssl_certificate(false, context)).to eq(false)
238
238
  end
239
239
 
240
240
  it "returns false if ssl_context doesn't have an error code of 0" do
241
241
  context = OpenSSL::X509::StoreContext.new(OpenSSL::X509::Store.new)
242
242
  context.error = 19 # ca_file incorrect, self-signed
243
- Braintree::Configuration.instantiate.http._verify_ssl_certificate(true, context).should == false
243
+ expect(Braintree::Configuration.instantiate.http._verify_ssl_certificate(true, context)).to eq(false)
244
244
  end
245
245
 
246
246
  it "doesn't raise if there is no error" do
@@ -258,8 +258,8 @@ describe Braintree::Http do
258
258
  utc_or_gmt = Time.now.utc.strftime("%Z")
259
259
  context = OpenSSL::X509::StoreContext.new(OpenSSL::X509::Store.new)
260
260
  context.error = 19
261
- Braintree::Configuration.instantiate.http._verify_ssl_certificate(false, context).should == false
262
- output.string.should include("SSL Verification failed -- Preverify: false, Error: self signed certificate in certificate chain (19)")
261
+ expect(Braintree::Configuration.instantiate.http._verify_ssl_certificate(false, context)).to eq(false)
262
+ expect(output.string).to include("SSL Verification failed -- Preverify: false, Error: self signed certificate in certificate chain (19)")
263
263
  ensure
264
264
  Braintree::Configuration.logger = old_logger
265
265
  end
@@ -275,7 +275,7 @@ describe Braintree::Http do
275
275
  expect do
276
276
  Braintree::Configuration.instantiate.http._verify_ssl_certificate(true, context)
277
277
  end.to_not raise_error
278
- output.string.should == ""
278
+ expect(output.string).to eq("")
279
279
  ensure
280
280
  Braintree::Configuration.logger = old_logger
281
281
  end