braintree 4.14.0 → 4.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/credit_card.rb +13 -0
  3. data/lib/braintree/credit_card_gateway.rb +15 -3
  4. data/lib/braintree/payment_method_gateway.rb +15 -3
  5. data/lib/braintree/test/nonce.rb +1 -0
  6. data/lib/braintree/test/venmo_sdk.rb +2 -0
  7. data/lib/braintree/transaction/credit_card_details.rb +3 -0
  8. data/lib/braintree/transaction/local_payment_details.rb +2 -0
  9. data/lib/braintree/transaction.rb +5 -4
  10. data/lib/braintree/transaction_gateway.rb +15 -3
  11. data/lib/braintree/transaction_search.rb +6 -5
  12. data/lib/braintree/version.rb +1 -1
  13. data/lib/braintree/webhook_notification.rb +1 -0
  14. data/lib/braintree/webhook_testing_gateway.rb +17 -0
  15. data/spec/integration/braintree/add_on_spec.rb +9 -9
  16. data/spec/integration/braintree/address_spec.rb +69 -69
  17. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  18. data/spec/integration/braintree/apple_pay_spec.rb +8 -8
  19. data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
  20. data/spec/integration/braintree/credit_card_spec.rb +223 -223
  21. data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
  22. data/spec/integration/braintree/credit_card_verification_spec.rb +52 -52
  23. data/spec/integration/braintree/customer_search_spec.rb +20 -20
  24. data/spec/integration/braintree/customer_spec.rb +313 -313
  25. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  26. data/spec/integration/braintree/discount_spec.rb +9 -9
  27. data/spec/integration/braintree/dispute_spec.rb +87 -87
  28. data/spec/integration/braintree/document_upload_spec.rb +17 -17
  29. data/spec/integration/braintree/error_codes_spec.rb +2 -2
  30. data/spec/integration/braintree/http_spec.rb +28 -28
  31. data/spec/integration/braintree/merchant_account_spec.rb +127 -127
  32. data/spec/integration/braintree/merchant_spec.rb +103 -103
  33. data/spec/integration/braintree/oauth_spec.rb +61 -61
  34. data/spec/integration/braintree/payment_method_nonce_spec.rb +73 -73
  35. data/spec/integration/braintree/payment_method_spec.rb +389 -389
  36. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +78 -78
  37. data/spec/integration/braintree/paypal_account_spec.rb +38 -38
  38. data/spec/integration/braintree/plan_spec.rb +15 -15
  39. data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
  40. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
  41. data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
  42. data/spec/integration/braintree/subscription_spec.rb +364 -364
  43. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  44. data/spec/integration/braintree/test_transaction_spec.rb +19 -19
  45. data/spec/integration/braintree/transaction_line_item_spec.rb +6 -6
  46. data/spec/integration/braintree/transaction_search_spec.rb +198 -165
  47. data/spec/integration/braintree/transaction_spec.rb +1315 -1149
  48. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
  49. data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
  50. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
  51. data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
  52. data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
  53. data/spec/spec_helper.rb +9 -8
  54. data/spec/unit/braintree/address_spec.rb +8 -8
  55. data/spec/unit/braintree/base_module_spec.rb +4 -4
  56. data/spec/unit/braintree/client_token_spec.rb +2 -2
  57. data/spec/unit/braintree/configuration_spec.rb +57 -57
  58. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  59. data/spec/unit/braintree/credit_card_spec.rb +31 -29
  60. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +28 -28
  61. data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
  62. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
  63. data/spec/unit/braintree/customer_spec.rb +41 -40
  64. data/spec/unit/braintree/digest_spec.rb +5 -5
  65. data/spec/unit/braintree/disbursement_spec.rb +11 -11
  66. data/spec/unit/braintree/dispute_search_spec.rb +2 -2
  67. data/spec/unit/braintree/dispute_spec.rb +56 -56
  68. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  69. data/spec/unit/braintree/enriched_customer_data_spec.rb +2 -2
  70. data/spec/unit/braintree/error_result_spec.rb +5 -5
  71. data/spec/unit/braintree/errors_spec.rb +9 -9
  72. data/spec/unit/braintree/http_spec.rb +8 -8
  73. data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
  74. data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
  75. data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
  76. data/spec/unit/braintree/merchant_account_spec.rb +4 -4
  77. data/spec/unit/braintree/modification_spec.rb +1 -1
  78. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
  79. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
  80. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
  81. data/spec/unit/braintree/payment_method_spec.rb +19 -19
  82. data/spec/unit/braintree/paypal_account_spec.rb +4 -4
  83. data/spec/unit/braintree/resource_collection_spec.rb +7 -7
  84. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
  85. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  86. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  87. data/spec/unit/braintree/subscription_search_spec.rb +17 -17
  88. data/spec/unit/braintree/subscription_spec.rb +8 -8
  89. data/spec/unit/braintree/successful_result_spec.rb +5 -5
  90. data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
  91. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
  92. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  93. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  94. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
  95. data/spec/unit/braintree/transaction_gateway_spec.rb +9 -6
  96. data/spec/unit/braintree/transaction_search_spec.rb +2 -2
  97. data/spec/unit/braintree/transaction_spec.rb +101 -93
  98. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  99. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  100. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  101. data/spec/unit/braintree/us_bank_account_verification_spec.rb +7 -7
  102. data/spec/unit/braintree/util_spec.rb +27 -27
  103. data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
  104. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  105. data/spec/unit/braintree/venmo_profile_data_spec.rb +5 -5
  106. data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
  107. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  108. data/spec/unit/braintree/xml/parser_spec.rb +8 -8
  109. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  110. data/spec/unit/braintree/xml_spec.rb +17 -17
  111. data/spec/unit/braintree_spec.rb +2 -2
  112. metadata +3 -2
@@ -9,42 +9,42 @@ describe Braintree::VisaCheckoutCard do
9
9
  :payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutDiscover,
10
10
  :customer_id => customer.id,
11
11
  )
12
- result.should be_success
12
+ expect(result).to be_success
13
13
 
14
14
  visa_checkout_card = result.payment_method
15
- visa_checkout_card.should be_a(Braintree::VisaCheckoutCard)
16
- visa_checkout_card.call_id.should == "abc123"
17
- visa_checkout_card.billing_address.should_not be_nil
18
- visa_checkout_card.bin.should_not be_nil
19
- visa_checkout_card.card_type.should_not be_nil
20
- visa_checkout_card.cardholder_name.should_not be_nil
21
- visa_checkout_card.commercial.should_not be_nil
22
- visa_checkout_card.country_of_issuance.should_not be_nil
23
- visa_checkout_card.created_at.should_not be_nil
24
- visa_checkout_card.customer_id.should_not be_nil
25
- visa_checkout_card.customer_location.should_not be_nil
26
- visa_checkout_card.debit.should_not be_nil
27
- visa_checkout_card.default?.should_not be_nil
28
- visa_checkout_card.durbin_regulated.should_not be_nil
29
- visa_checkout_card.expiration_date.should_not be_nil
30
- visa_checkout_card.expiration_month.should_not be_nil
31
- visa_checkout_card.expiration_year.should_not be_nil
32
- visa_checkout_card.expired?.should_not be_nil
33
- visa_checkout_card.healthcare.should_not be_nil
34
- visa_checkout_card.image_url.should_not be_nil
35
- visa_checkout_card.issuing_bank.should_not be_nil
36
- visa_checkout_card.last_4.should_not be_nil
37
- visa_checkout_card.payroll.should_not be_nil
38
- visa_checkout_card.prepaid.should_not be_nil
39
- visa_checkout_card.product_id.should_not be_nil
40
- visa_checkout_card.subscriptions.should_not be_nil
41
- visa_checkout_card.token.should_not be_nil
42
- visa_checkout_card.unique_number_identifier.should_not be_nil
43
- visa_checkout_card.updated_at.should_not be_nil
15
+ expect(visa_checkout_card).to be_a(Braintree::VisaCheckoutCard)
16
+ expect(visa_checkout_card.call_id).to eq("abc123")
17
+ expect(visa_checkout_card.billing_address).not_to be_nil
18
+ expect(visa_checkout_card.bin).not_to be_nil
19
+ expect(visa_checkout_card.card_type).not_to be_nil
20
+ expect(visa_checkout_card.cardholder_name).not_to be_nil
21
+ expect(visa_checkout_card.commercial).not_to be_nil
22
+ expect(visa_checkout_card.country_of_issuance).not_to be_nil
23
+ expect(visa_checkout_card.created_at).not_to be_nil
24
+ expect(visa_checkout_card.customer_id).not_to be_nil
25
+ expect(visa_checkout_card.customer_location).not_to be_nil
26
+ expect(visa_checkout_card.debit).not_to be_nil
27
+ expect(visa_checkout_card.default?).not_to be_nil
28
+ expect(visa_checkout_card.durbin_regulated).not_to be_nil
29
+ expect(visa_checkout_card.expiration_date).not_to be_nil
30
+ expect(visa_checkout_card.expiration_month).not_to be_nil
31
+ expect(visa_checkout_card.expiration_year).not_to be_nil
32
+ expect(visa_checkout_card.expired?).not_to be_nil
33
+ expect(visa_checkout_card.healthcare).not_to be_nil
34
+ expect(visa_checkout_card.image_url).not_to be_nil
35
+ expect(visa_checkout_card.issuing_bank).not_to be_nil
36
+ expect(visa_checkout_card.last_4).not_to be_nil
37
+ expect(visa_checkout_card.payroll).not_to be_nil
38
+ expect(visa_checkout_card.prepaid).not_to be_nil
39
+ expect(visa_checkout_card.product_id).not_to be_nil
40
+ expect(visa_checkout_card.subscriptions).not_to be_nil
41
+ expect(visa_checkout_card.token).not_to be_nil
42
+ expect(visa_checkout_card.unique_number_identifier).not_to be_nil
43
+ expect(visa_checkout_card.updated_at).not_to be_nil
44
44
 
45
45
  customer = Braintree::Customer.find(customer.id)
46
- customer.visa_checkout_cards.size.should == 1
47
- customer.visa_checkout_cards.first.should == visa_checkout_card
46
+ expect(customer.visa_checkout_cards.size).to eq(1)
47
+ expect(customer.visa_checkout_cards.first).to eq(visa_checkout_card)
48
48
  end
49
49
 
50
50
  it "can create with verification" do
@@ -55,8 +55,8 @@ describe Braintree::VisaCheckoutCard do
55
55
  :customer_id => customer.id,
56
56
  :options => {:verify_card => true},
57
57
  )
58
- result.should be_success
59
- result.payment_method.verification.status.should == Braintree::CreditCardVerification::Status::Verified
58
+ expect(result).to be_success
59
+ expect(result.payment_method.verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
60
60
  end
61
61
 
62
62
  it "can search for transactions" do
@@ -64,14 +64,14 @@ describe Braintree::VisaCheckoutCard do
64
64
  :payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutDiscover,
65
65
  :amount => "47.00",
66
66
  )
67
- transaction_create_result.should be_success
67
+ expect(transaction_create_result).to be_success
68
68
  transaction_id = transaction_create_result.transaction.id
69
69
 
70
70
  search_results = Braintree::Transaction.search do |search|
71
71
  search.id.is transaction_id
72
72
  search.payment_instrument_type.is Braintree::PaymentInstrumentType::VisaCheckoutCard
73
73
  end
74
- search_results.first.id.should == transaction_id
74
+ expect(search_results.first.id).to eq(transaction_id)
75
75
  end
76
76
 
77
77
  it "can create transaction from nonce and vault" do
@@ -83,28 +83,28 @@ describe Braintree::VisaCheckoutCard do
83
83
  :amount => "47.00",
84
84
  :options => {:store_in_vault => true},
85
85
  )
86
- result.should be_success
86
+ expect(result).to be_success
87
87
 
88
88
  visa_checkout_card_details = result.transaction.visa_checkout_card_details
89
- visa_checkout_card_details.call_id.should == "abc123"
90
- visa_checkout_card_details.bin.should_not be_nil
91
- visa_checkout_card_details.card_type.should_not be_nil
92
- visa_checkout_card_details.cardholder_name.should_not be_nil
93
- visa_checkout_card_details.commercial.should_not be_nil
94
- visa_checkout_card_details.country_of_issuance.should_not be_nil
95
- visa_checkout_card_details.customer_location.should_not be_nil
96
- visa_checkout_card_details.debit.should_not be_nil
97
- visa_checkout_card_details.durbin_regulated.should_not be_nil
98
- visa_checkout_card_details.expiration_date.should_not be_nil
99
- visa_checkout_card_details.expiration_month.should_not be_nil
100
- visa_checkout_card_details.expiration_year.should_not be_nil
101
- visa_checkout_card_details.healthcare.should_not be_nil
102
- visa_checkout_card_details.image_url.should_not be_nil
103
- visa_checkout_card_details.issuing_bank.should_not be_nil
104
- visa_checkout_card_details.last_4.should_not be_nil
105
- visa_checkout_card_details.payroll.should_not be_nil
106
- visa_checkout_card_details.prepaid.should_not be_nil
107
- visa_checkout_card_details.product_id.should_not be_nil
108
- visa_checkout_card_details.token.should_not be_nil
89
+ expect(visa_checkout_card_details.call_id).to eq("abc123")
90
+ expect(visa_checkout_card_details.bin).not_to be_nil
91
+ expect(visa_checkout_card_details.card_type).not_to be_nil
92
+ expect(visa_checkout_card_details.cardholder_name).not_to be_nil
93
+ expect(visa_checkout_card_details.commercial).not_to be_nil
94
+ expect(visa_checkout_card_details.country_of_issuance).not_to be_nil
95
+ expect(visa_checkout_card_details.customer_location).not_to be_nil
96
+ expect(visa_checkout_card_details.debit).not_to be_nil
97
+ expect(visa_checkout_card_details.durbin_regulated).not_to be_nil
98
+ expect(visa_checkout_card_details.expiration_date).not_to be_nil
99
+ expect(visa_checkout_card_details.expiration_month).not_to be_nil
100
+ expect(visa_checkout_card_details.expiration_year).not_to be_nil
101
+ expect(visa_checkout_card_details.healthcare).not_to be_nil
102
+ expect(visa_checkout_card_details.image_url).not_to be_nil
103
+ expect(visa_checkout_card_details.issuing_bank).not_to be_nil
104
+ expect(visa_checkout_card_details.last_4).not_to be_nil
105
+ expect(visa_checkout_card_details.payroll).not_to be_nil
106
+ expect(visa_checkout_card_details.prepaid).not_to be_nil
107
+ expect(visa_checkout_card_details.product_id).not_to be_nil
108
+ expect(visa_checkout_card_details.token).not_to be_nil
109
109
  end
110
110
  end
data/spec/spec_helper.rb CHANGED
@@ -30,19 +30,20 @@ unless defined?(SPEC_HELPER_LOADED)
30
30
 
31
31
  module SpecHelper
32
32
 
33
+ AdyenMerchantAccountId = "adyen_ma"
34
+ AibSwedenMaMerchantAccountId = "aib_swe_ma"
35
+ AnotherUsBankMerchantAccountId = "another_us_bank_merchant_account"
36
+ CardProcessorBRLMerchantAccountId = "card_processor_brl"
33
37
  DefaultMerchantAccountId = "sandbox_credit_card"
38
+ FakeAmexDirectMerchantAccountId = "fake_amex_direct_usd"
39
+ FakeFirstDataMerchantAccountId = "fake_first_data_merchant_account"
40
+ FakeVenmoAccountMerchantAccountId = "fake_first_data_venmo_account"
41
+ HiperBRLMerchantAccountId = "hiper_brl"
34
42
  NonDefaultMerchantAccountId = "sandbox_credit_card_non_default"
35
43
  NonDefaultSubMerchantAccountId = "sandbox_sub_merchant_account"
44
+ PinlessDebitMerchantAccountId = "pinless_debit"
36
45
  ThreeDSecureMerchantAccountId = "three_d_secure_merchant_account"
37
- FakeAmexDirectMerchantAccountId = "fake_amex_direct_usd"
38
- FakeVenmoAccountMerchantAccountId = "fake_first_data_venmo_account"
39
46
  UsBankMerchantAccountId = "us_bank_merchant_account"
40
- AnotherUsBankMerchantAccountId = "another_us_bank_merchant_account"
41
- AdyenMerchantAccountId = "adyen_ma"
42
- HiperBRLMerchantAccountId = "hiper_brl"
43
- CardProcessorBRLMerchantAccountId = "card_processor_brl"
44
- FakeFirstDataMerchantAccountId = "fake_first_data_merchant_account"
45
- AibSwedenMaMerchantAccountId = "aib_swe_ma"
46
47
 
47
48
  TrialPlan = {
48
49
  :description => "Plan for integration tests -- with trial",
@@ -6,29 +6,29 @@ describe Braintree::Address do
6
6
  first = Braintree::Address._new(:gateway, :customer_id => "c1", :id => "a1")
7
7
  second = Braintree::Address._new(:gateway, :customer_id => "c1", :id => "a1")
8
8
 
9
- first.should == second
10
- second.should == first
9
+ expect(first).to eq(second)
10
+ expect(second).to eq(first)
11
11
  end
12
12
 
13
13
  it "returns false if given an address with a different id and the same customer_id" do
14
14
  first = Braintree::Address._new(:gateway, :customer_id => "c1", :id => "a1")
15
15
  second = Braintree::Address._new(:gateway, :customer_id => "c1", :id => "not a1")
16
16
 
17
- first.should_not == second
18
- second.should_not == first
17
+ expect(first).not_to eq(second)
18
+ expect(second).not_to eq(first)
19
19
  end
20
20
 
21
21
  it "returns false if given an address with a different customer_id and the same id" do
22
22
  first = Braintree::Address._new(:gateway, :customer_id => "c1", :id => "a1")
23
23
  second = Braintree::Address._new(:gateway, :customer_id => "not c1", :id => "a1")
24
24
 
25
- first.should_not == second
26
- second.should_not == first
25
+ expect(first).not_to eq(second)
26
+ expect(second).not_to eq(first)
27
27
  end
28
28
 
29
29
  it "returns false when not given an address" do
30
30
  address = Braintree::Address._new(:gateway, :id => "a1")
31
- address.should_not == "not an address"
31
+ expect(address).not_to eq("not an address")
32
32
  end
33
33
  end
34
34
 
@@ -80,7 +80,7 @@ describe Braintree::Address do
80
80
  end
81
81
 
82
82
  it "does not raise an error if address_id does not respond to strip" do
83
- Braintree::Http.stub(:new).and_return double.as_null_object
83
+ allow(Braintree::Http).to receive(:new).and_return double.as_null_object
84
84
  expect do
85
85
  Braintree::Address.find("customer_id", 8675309)
86
86
  end.to_not raise_error
@@ -9,10 +9,10 @@ describe Braintree::BaseModule do
9
9
  klass.return_object_or_raise(:obj) { result }
10
10
  rescue Braintree::ValidationsFailed => ex
11
11
  end
12
- ex.should_not == nil
13
- ex.error_result.should == result
14
- ex.inspect.should include(result.inspect)
15
- ex.to_s.should include(result.inspect)
12
+ expect(ex).not_to eq(nil)
13
+ expect(ex.error_result).to eq(result)
14
+ expect(ex.inspect).to include(result.inspect)
15
+ expect(ex.to_s).to include(result.inspect)
16
16
  end
17
17
  end
18
18
  end
@@ -7,8 +7,8 @@ module Braintree
7
7
  it "delegates to ClientTokenGateway#generate" do
8
8
  options = {:foo => :bar}
9
9
  client_token_gateway = double(:client_token_gateway)
10
- client_token_gateway.should_receive(:generate).with(options).once
11
- ClientTokenGateway.stub(:new).and_return(client_token_gateway)
10
+ expect(client_token_gateway).to receive(:generate).with(options).once
11
+ allow(ClientTokenGateway).to receive(:new).and_return(client_token_gateway)
12
12
  ClientToken.generate(options)
13
13
  end
14
14
 
@@ -27,9 +27,9 @@ describe Braintree::Configuration do
27
27
  :private_key => "private_key",
28
28
  )
29
29
 
30
- config.merchant_id.should == "merchant_id"
31
- config.public_key.should == "public_key"
32
- config.private_key.should == "private_key"
30
+ expect(config.merchant_id).to eq("merchant_id")
31
+ expect(config.public_key).to eq("public_key")
32
+ expect(config.private_key).to eq("private_key")
33
33
  end
34
34
 
35
35
  it "accepts partner credentials" do
@@ -39,9 +39,9 @@ describe Braintree::Configuration do
39
39
  :private_key => "private_key",
40
40
  )
41
41
 
42
- config.merchant_id.should == "partner_id"
43
- config.public_key.should == "public_key"
44
- config.private_key.should == "private_key"
42
+ expect(config.merchant_id).to eq("partner_id")
43
+ expect(config.public_key).to eq("public_key")
44
+ expect(config.private_key).to eq("private_key")
45
45
  end
46
46
 
47
47
  it "raises if combining client_id/secret with access_token" do
@@ -82,7 +82,7 @@ describe Braintree::Configuration do
82
82
  :access_token => "access_token$development$integration_merchant_id$fb27c79dd",
83
83
  :environment => "sandbox",
84
84
  )
85
- $stderr.string.should == "Braintree::Gateway should not be initialized with mixed environments: environment parameter and access_token do not match, environment from access_token is used.\n"
85
+ expect($stderr.string).to eq("Braintree::Gateway should not be initialized with mixed environments: environment parameter and access_token do not match, environment from access_token is used.\n")
86
86
  end
87
87
 
88
88
  it "does not warn if both environment and access_token are provided and their environments match" do
@@ -90,7 +90,7 @@ describe Braintree::Configuration do
90
90
  :access_token => "access_token$development$integration_merchant_id$fb27c79dd",
91
91
  :environment => "development",
92
92
  )
93
- $stderr.string.should == ""
93
+ expect($stderr.string).to eq("")
94
94
  end
95
95
  end
96
96
 
@@ -102,10 +102,10 @@ describe Braintree::Configuration do
102
102
  :proxy_pass => "test",
103
103
  )
104
104
 
105
- config.proxy_address.should == "localhost"
106
- config.proxy_port.should == 8080
107
- config.proxy_user.should == "user"
108
- config.proxy_pass.should == "test"
105
+ expect(config.proxy_address).to eq("localhost")
106
+ expect(config.proxy_port).to eq(8080)
107
+ expect(config.proxy_user).to eq("user")
108
+ expect(config.proxy_pass).to eq("test")
109
109
  end
110
110
 
111
111
  it "accepts ssl version" do
@@ -113,13 +113,13 @@ describe Braintree::Configuration do
113
113
  :ssl_version => :TLSv1_2,
114
114
  )
115
115
 
116
- config.ssl_version.should == :TLSv1_2
116
+ expect(config.ssl_version).to eq(:TLSv1_2)
117
117
  end
118
118
  end
119
119
 
120
120
  describe "base_merchant_path" do
121
121
  it "returns /merchants/{merchant_id}" do
122
- Braintree::Configuration.instantiate.base_merchant_path.should == "/merchants/integration_merchant_id"
122
+ expect(Braintree::Configuration.instantiate.base_merchant_path).to eq("/merchants/integration_merchant_id")
123
123
  end
124
124
  end
125
125
 
@@ -127,17 +127,17 @@ describe Braintree::Configuration do
127
127
  it "returns the expected url for the development env" do
128
128
  Braintree::Configuration.environment = :development
129
129
  port = Braintree::Configuration.instantiate.port
130
- Braintree::Configuration.instantiate.base_merchant_url.should == "http://localhost:#{port}/merchants/integration_merchant_id"
130
+ expect(Braintree::Configuration.instantiate.base_merchant_url).to eq("http://localhost:#{port}/merchants/integration_merchant_id")
131
131
  end
132
132
 
133
133
  it "returns the expected url for the sandbox env" do
134
134
  Braintree::Configuration.environment = :sandbox
135
- Braintree::Configuration.instantiate.base_merchant_url.should == "https://api.sandbox.braintreegateway.com:443/merchants/integration_merchant_id"
135
+ expect(Braintree::Configuration.instantiate.base_merchant_url).to eq("https://api.sandbox.braintreegateway.com:443/merchants/integration_merchant_id")
136
136
  end
137
137
 
138
138
  it "returns the expected url for the production env" do
139
139
  Braintree::Configuration.environment = :production
140
- Braintree::Configuration.instantiate.base_merchant_url.should == "https://api.braintreegateway.com:443/merchants/integration_merchant_id"
140
+ expect(Braintree::Configuration.instantiate.base_merchant_url).to eq("https://api.braintreegateway.com:443/merchants/integration_merchant_id")
141
141
  end
142
142
  end
143
143
 
@@ -145,27 +145,27 @@ describe Braintree::Configuration do
145
145
  it "sandbox" do
146
146
  Braintree::Configuration.environment = :sandbox
147
147
  ca_file = Braintree::Configuration.instantiate.ca_file
148
- ca_file.should match(/api_braintreegateway_com\.ca\.crt$/)
149
- File.exist?(ca_file).should == true
148
+ expect(ca_file).to match(/api_braintreegateway_com\.ca\.crt$/)
149
+ expect(File.exist?(ca_file)).to eq(true)
150
150
  end
151
151
 
152
152
  it "production" do
153
153
  Braintree::Configuration.environment = :production
154
154
  ca_file = Braintree::Configuration.instantiate.ca_file
155
- ca_file.should match(/api_braintreegateway_com\.ca\.crt$/)
156
- File.exist?(ca_file).should == true
155
+ expect(ca_file).to match(/api_braintreegateway_com\.ca\.crt$/)
156
+ expect(File.exist?(ca_file)).to eq(true)
157
157
  end
158
158
  end
159
159
 
160
160
  describe "logger" do
161
161
  it "defaults to logging to stdout with log_level info" do
162
162
  config = Braintree::Configuration.new
163
- config.logger.level.should == Logger::INFO
163
+ expect(config.logger.level).to eq(Logger::INFO)
164
164
  end
165
165
 
166
166
  it "lazily initializes so that you can do Braintree::Configuration.logger.level = when configuring the client lib" do
167
167
  config = Braintree::Configuration.new :logger => nil
168
- config.logger.should_not == nil
168
+ expect(config.logger).not_to eq(nil)
169
169
  end
170
170
 
171
171
  it "can set logger on gateway instance" do
@@ -215,17 +215,17 @@ describe Braintree::Configuration do
215
215
 
216
216
  gateway = Braintree::Configuration.gateway
217
217
 
218
- gateway.config.proxy_address.should == "localhost"
219
- gateway.config.proxy_port.should == 8080
220
- gateway.config.proxy_user.should == "user"
221
- gateway.config.proxy_pass.should == "test"
218
+ expect(gateway.config.proxy_address).to eq("localhost")
219
+ expect(gateway.config.proxy_port).to eq(8080)
220
+ expect(gateway.config.proxy_user).to eq("user")
221
+ expect(gateway.config.proxy_pass).to eq("test")
222
222
  end
223
223
 
224
224
  it "sets the ssl version" do
225
225
  Braintree::Configuration.ssl_version = :TLSv1_2
226
226
  gateway = Braintree::Configuration.gateway
227
227
 
228
- gateway.config.ssl_version.should == :TLSv1_2
228
+ expect(gateway.config.ssl_version).to eq(:TLSv1_2)
229
229
  end
230
230
  end
231
231
 
@@ -253,7 +253,7 @@ describe Braintree::Configuration do
253
253
  begin
254
254
  old_logger = Braintree::Configuration.logger
255
255
  Braintree::Configuration.logger = nil
256
- Braintree::Configuration.instantiate.logger.level.should == Logger::INFO
256
+ expect(Braintree::Configuration.instantiate.logger.level).to eq(Logger::INFO)
257
257
  ensure
258
258
  Braintree::Configuration.logger = old_logger
259
259
  end
@@ -261,7 +261,7 @@ describe Braintree::Configuration do
261
261
 
262
262
  it "lazily initializes so that you can do Braintree::Configuration.logger.level = when configuring the client lib" do
263
263
  Braintree::Configuration.logger = nil
264
- Braintree::Configuration.logger.should_not == nil
264
+ expect(Braintree::Configuration.logger).not_to eq(nil)
265
265
  end
266
266
  end
267
267
 
@@ -316,12 +316,12 @@ describe Braintree::Configuration do
316
316
  describe "self.port" do
317
317
  it "is 443 for production" do
318
318
  Braintree::Configuration.environment = :production
319
- Braintree::Configuration.instantiate.port.should == 443
319
+ expect(Braintree::Configuration.instantiate.port).to eq(443)
320
320
  end
321
321
 
322
322
  it "is 443 for sandbox" do
323
323
  Braintree::Configuration.environment = :sandbox
324
- Braintree::Configuration.instantiate.port.should == 443
324
+ expect(Braintree::Configuration.instantiate.port).to eq(443)
325
325
  end
326
326
 
327
327
  it "is 3000 or GATEWAY_PORT environment variable for development" do
@@ -329,10 +329,10 @@ describe Braintree::Configuration do
329
329
  old_gateway_port = ENV["GATEWAY_PORT"]
330
330
  begin
331
331
  ENV["GATEWAY_PORT"] = nil
332
- Braintree::Configuration.instantiate.port.should == 3000
332
+ expect(Braintree::Configuration.instantiate.port).to eq(3000)
333
333
 
334
334
  ENV["GATEWAY_PORT"] = "1234"
335
- Braintree::Configuration.instantiate.port.should == "1234"
335
+ expect(Braintree::Configuration.instantiate.port).to eq("1234")
336
336
  ensure
337
337
  ENV["GATEWAY_PORT"] = old_gateway_port
338
338
  end
@@ -342,17 +342,17 @@ describe Braintree::Configuration do
342
342
  describe "self.protocol" do
343
343
  it "is http for development" do
344
344
  Braintree::Configuration.environment = :development
345
- Braintree::Configuration.instantiate.protocol.should == "http"
345
+ expect(Braintree::Configuration.instantiate.protocol).to eq("http")
346
346
  end
347
347
 
348
348
  it "is https for production" do
349
349
  Braintree::Configuration.environment = :production
350
- Braintree::Configuration.instantiate.protocol.should == "https"
350
+ expect(Braintree::Configuration.instantiate.protocol).to eq("https")
351
351
  end
352
352
 
353
353
  it "is https for sandbox" do
354
354
  Braintree::Configuration.environment = :sandbox
355
- Braintree::Configuration.instantiate.protocol.should == "https"
355
+ expect(Braintree::Configuration.instantiate.protocol).to eq("https")
356
356
  end
357
357
  end
358
358
 
@@ -362,10 +362,10 @@ describe Braintree::Configuration do
362
362
  old_gateway_url = ENV["GRAPHQL_HOST"]
363
363
  begin
364
364
  ENV["GRAPHQL_HOST"] = nil
365
- Braintree::Configuration.instantiate.graphql_server.should == "graphql.bt.local"
365
+ expect(Braintree::Configuration.instantiate.graphql_server).to eq("graphql.bt.local")
366
366
 
367
367
  ENV["GRAPHQL_HOST"] = "gateway"
368
- Braintree::Configuration.instantiate.graphql_server.should == "gateway"
368
+ expect(Braintree::Configuration.instantiate.graphql_server).to eq("gateway")
369
369
  ensure
370
370
  ENV["GRAPHQL_HOST"] = old_gateway_url
371
371
  end
@@ -378,10 +378,10 @@ describe Braintree::Configuration do
378
378
  old_gateway_url = ENV["GATEWAY_HOST"]
379
379
  begin
380
380
  ENV["GATEWAY_HOST"] = nil
381
- Braintree::Configuration.instantiate.server.should == "localhost"
381
+ expect(Braintree::Configuration.instantiate.server).to eq("localhost")
382
382
 
383
383
  ENV["GATEWAY_HOST"] = "gateway"
384
- Braintree::Configuration.instantiate.server.should == "gateway"
384
+ expect(Braintree::Configuration.instantiate.server).to eq("gateway")
385
385
  ensure
386
386
  ENV["GATEWAY_HOST"] = old_gateway_url
387
387
  end
@@ -389,62 +389,62 @@ describe Braintree::Configuration do
389
389
 
390
390
  it "is api.braintreegateway.com for production" do
391
391
  Braintree::Configuration.environment = :production
392
- Braintree::Configuration.instantiate.server.should == "api.braintreegateway.com"
392
+ expect(Braintree::Configuration.instantiate.server).to eq("api.braintreegateway.com")
393
393
  end
394
394
 
395
395
  it "is api.sandbox.braintreegateway.com for sandbox" do
396
396
  Braintree::Configuration.environment = :sandbox
397
- Braintree::Configuration.instantiate.server.should == "api.sandbox.braintreegateway.com"
397
+ expect(Braintree::Configuration.instantiate.server).to eq("api.sandbox.braintreegateway.com")
398
398
  end
399
399
 
400
400
  it "is qa.braintreegateway.com for qa" do
401
401
  Braintree::Configuration.environment = :qa
402
- Braintree::Configuration.instantiate.server.should == "gateway.qa.braintreepayments.com"
402
+ expect(Braintree::Configuration.instantiate.server).to eq("gateway.qa.braintreepayments.com")
403
403
  end
404
404
 
405
405
  it "can by changed by configuring the production endpoint" do
406
406
  Braintree::Configuration.environment = :production
407
407
  Braintree::Configuration.endpoint = "custom-endpoint"
408
- Braintree::Configuration.instantiate.server.should == "custom-endpoint.braintreegateway.com"
408
+ expect(Braintree::Configuration.instantiate.server).to eq("custom-endpoint.braintreegateway.com")
409
409
  end
410
410
  end
411
411
 
412
412
  describe "auth_url" do
413
413
  it "is http://auth.venmo.dev for development" do
414
414
  Braintree::Configuration.environment = :development
415
- Braintree::Configuration.instantiate.auth_url.should == "http://auth.venmo.dev:9292"
415
+ expect(Braintree::Configuration.instantiate.auth_url).to eq("http://auth.venmo.dev:9292")
416
416
  end
417
417
 
418
418
  it "is https://auth.venmo.com for production" do
419
419
  Braintree::Configuration.environment = :production
420
- Braintree::Configuration.instantiate.auth_url.should == "https://auth.venmo.com"
420
+ expect(Braintree::Configuration.instantiate.auth_url).to eq("https://auth.venmo.com")
421
421
  end
422
422
 
423
423
  it "is https://auth.sandbox.venmo.com for sandbox" do
424
424
  Braintree::Configuration.environment = :sandbox
425
- Braintree::Configuration.instantiate.auth_url.should == "https://auth.venmo.sandbox.braintreegateway.com"
425
+ expect(Braintree::Configuration.instantiate.auth_url).to eq("https://auth.venmo.sandbox.braintreegateway.com")
426
426
  end
427
427
 
428
428
  it "is https://auth.qa.venmo.com for qa" do
429
429
  Braintree::Configuration.environment = :qa
430
- Braintree::Configuration.instantiate.auth_url.should == "https://auth.venmo.qa2.braintreegateway.com"
430
+ expect(Braintree::Configuration.instantiate.auth_url).to eq("https://auth.venmo.qa2.braintreegateway.com")
431
431
  end
432
432
  end
433
433
 
434
434
  describe "ssl?" do
435
435
  it "returns false for development" do
436
436
  Braintree::Configuration.environment = :development
437
- Braintree::Configuration.instantiate.ssl?.should == false
437
+ expect(Braintree::Configuration.instantiate.ssl?).to eq(false)
438
438
  end
439
439
 
440
440
  it "returns true for production" do
441
441
  Braintree::Configuration.environment = :production
442
- Braintree::Configuration.instantiate.ssl?.should == true
442
+ expect(Braintree::Configuration.instantiate.ssl?).to eq(true)
443
443
  end
444
444
 
445
445
  it "returns true for sandbox" do
446
446
  Braintree::Configuration.environment = :sandbox
447
- Braintree::Configuration.instantiate.ssl?.should == true
447
+ expect(Braintree::Configuration.instantiate.ssl?).to eq(true)
448
448
  end
449
449
  end
450
450
 
@@ -455,20 +455,20 @@ describe Braintree::Configuration do
455
455
 
456
456
  it "appends the default user_agent with the given value" do
457
457
  Braintree::Configuration.custom_user_agent = "ActiveMerchant 1.2.3"
458
- Braintree::Configuration.instantiate.user_agent.should == "Braintree Ruby Gem #{Braintree::Version::String} (ActiveMerchant 1.2.3)"
458
+ expect(Braintree::Configuration.instantiate.user_agent).to eq("Braintree Ruby Gem #{Braintree::Version::String} (ActiveMerchant 1.2.3)")
459
459
  end
460
460
 
461
461
  it "does not append anything if there is no custom_user_agent" do
462
462
  Braintree::Configuration.custom_user_agent = nil
463
- Braintree::Configuration.instantiate.user_agent.should == "Braintree Ruby Gem #{Braintree::Version::String}"
463
+ expect(Braintree::Configuration.instantiate.user_agent).to eq("Braintree Ruby Gem #{Braintree::Version::String}")
464
464
  end
465
465
  end
466
466
 
467
467
  describe "inspect" do
468
468
  it "masks the private_key" do
469
469
  config = Braintree::Configuration.new(:private_key => "secret_key")
470
- config.inspect.should include('@private_key="[FILTERED]"')
471
- config.inspect.should_not include("secret_key")
470
+ expect(config.inspect).to include('@private_key="[FILTERED]"')
471
+ expect(config.inspect).not_to include("secret_key")
472
472
  end
473
473
  end
474
474
 
@@ -476,7 +476,7 @@ describe Braintree::Configuration do
476
476
  it "has a signature service initialized with the private key" do
477
477
  config = Braintree::Configuration.new(:private_key => "secret_key")
478
478
 
479
- config.signature_service.key.should == "secret_key"
479
+ expect(config.signature_service.key).to eq("secret_key")
480
480
  end
481
481
  end
482
482
  end
@@ -6,9 +6,9 @@ describe Braintree::CredentialsParser do
6
6
  parser = Braintree::CredentialsParser.new
7
7
  parser.parse_client_credentials("client_id$development$integration_client_id", "client_secret$development$integration_client_secret")
8
8
 
9
- parser.client_id.should == "client_id$development$integration_client_id"
10
- parser.client_secret.should == "client_secret$development$integration_client_secret"
11
- parser.environment.should == :development
9
+ expect(parser.client_id).to eq("client_id$development$integration_client_id")
10
+ expect(parser.client_secret).to eq("client_secret$development$integration_client_secret")
11
+ expect(parser.environment).to eq(:development)
12
12
  end
13
13
 
14
14
  it "raises error on inconsistent environment" do
@@ -57,9 +57,9 @@ describe Braintree::CredentialsParser do
57
57
  parser = Braintree::CredentialsParser.new
58
58
  parser.parse_access_token("access_token$development$integration_merchant_id$fb27c79dd")
59
59
 
60
- parser.merchant_id.should == "integration_merchant_id"
61
- parser.access_token.should == "access_token$development$integration_merchant_id$fb27c79dd"
62
- parser.environment.should == :development
60
+ expect(parser.merchant_id).to eq("integration_merchant_id")
61
+ expect(parser.access_token).to eq("access_token$development$integration_merchant_id$fb27c79dd")
62
+ expect(parser.environment).to eq(:development)
63
63
  end
64
64
 
65
65
  it "raises error on nil access_token" do