braintree 4.13.0 → 4.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/credit_card.rb +13 -0
  3. data/lib/braintree/credit_card_gateway.rb +15 -3
  4. data/lib/braintree/payment_method_gateway.rb +15 -3
  5. data/lib/braintree/test/nonce.rb +1 -0
  6. data/lib/braintree/test/venmo_sdk.rb +2 -0
  7. data/lib/braintree/transaction/credit_card_details.rb +3 -0
  8. data/lib/braintree/transaction/local_payment_details.rb +2 -0
  9. data/lib/braintree/transaction/payment_receipt/card_present_data.rb +36 -0
  10. data/lib/braintree/transaction/payment_receipt/merchant_address.rb +19 -0
  11. data/lib/braintree/transaction/payment_receipt.rb +31 -0
  12. data/lib/braintree/transaction/us_bank_account_details.rb +1 -0
  13. data/lib/braintree/transaction.rb +7 -4
  14. data/lib/braintree/transaction_gateway.rb +15 -3
  15. data/lib/braintree/transaction_search.rb +6 -5
  16. data/lib/braintree/version.rb +1 -1
  17. data/lib/braintree/webhook_notification.rb +1 -0
  18. data/lib/braintree/webhook_testing_gateway.rb +17 -0
  19. data/lib/braintree.rb +3 -0
  20. data/spec/integration/braintree/add_on_spec.rb +9 -9
  21. data/spec/integration/braintree/address_spec.rb +69 -69
  22. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  23. data/spec/integration/braintree/apple_pay_spec.rb +8 -8
  24. data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
  25. data/spec/integration/braintree/credit_card_spec.rb +223 -223
  26. data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
  27. data/spec/integration/braintree/credit_card_verification_spec.rb +52 -52
  28. data/spec/integration/braintree/customer_search_spec.rb +20 -20
  29. data/spec/integration/braintree/customer_spec.rb +313 -313
  30. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  31. data/spec/integration/braintree/discount_spec.rb +9 -9
  32. data/spec/integration/braintree/dispute_spec.rb +87 -87
  33. data/spec/integration/braintree/document_upload_spec.rb +17 -17
  34. data/spec/integration/braintree/error_codes_spec.rb +2 -2
  35. data/spec/integration/braintree/http_spec.rb +28 -28
  36. data/spec/integration/braintree/merchant_account_spec.rb +127 -127
  37. data/spec/integration/braintree/merchant_spec.rb +103 -103
  38. data/spec/integration/braintree/oauth_spec.rb +61 -61
  39. data/spec/integration/braintree/payment_method_nonce_spec.rb +73 -73
  40. data/spec/integration/braintree/payment_method_spec.rb +389 -389
  41. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +78 -78
  42. data/spec/integration/braintree/paypal_account_spec.rb +38 -38
  43. data/spec/integration/braintree/plan_spec.rb +15 -15
  44. data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
  45. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
  46. data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
  47. data/spec/integration/braintree/subscription_spec.rb +364 -364
  48. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  49. data/spec/integration/braintree/test_transaction_spec.rb +19 -19
  50. data/spec/integration/braintree/transaction_line_item_spec.rb +6 -6
  51. data/spec/integration/braintree/transaction_search_spec.rb +198 -165
  52. data/spec/integration/braintree/transaction_spec.rb +1319 -1151
  53. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
  54. data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
  55. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
  56. data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
  57. data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
  58. data/spec/spec_helper.rb +9 -8
  59. data/spec/unit/braintree/address_spec.rb +8 -8
  60. data/spec/unit/braintree/base_module_spec.rb +4 -4
  61. data/spec/unit/braintree/client_token_spec.rb +2 -2
  62. data/spec/unit/braintree/configuration_spec.rb +57 -57
  63. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  64. data/spec/unit/braintree/credit_card_spec.rb +31 -29
  65. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +28 -28
  66. data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
  67. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
  68. data/spec/unit/braintree/customer_spec.rb +41 -40
  69. data/spec/unit/braintree/digest_spec.rb +5 -5
  70. data/spec/unit/braintree/disbursement_spec.rb +11 -11
  71. data/spec/unit/braintree/dispute_search_spec.rb +2 -2
  72. data/spec/unit/braintree/dispute_spec.rb +56 -56
  73. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  74. data/spec/unit/braintree/enriched_customer_data_spec.rb +2 -2
  75. data/spec/unit/braintree/error_result_spec.rb +5 -5
  76. data/spec/unit/braintree/errors_spec.rb +9 -9
  77. data/spec/unit/braintree/http_spec.rb +8 -8
  78. data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
  79. data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
  80. data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
  81. data/spec/unit/braintree/merchant_account_spec.rb +4 -4
  82. data/spec/unit/braintree/modification_spec.rb +1 -1
  83. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
  84. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
  85. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
  86. data/spec/unit/braintree/payment_method_spec.rb +19 -19
  87. data/spec/unit/braintree/paypal_account_spec.rb +4 -4
  88. data/spec/unit/braintree/resource_collection_spec.rb +7 -7
  89. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
  90. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  91. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  92. data/spec/unit/braintree/subscription_search_spec.rb +17 -17
  93. data/spec/unit/braintree/subscription_spec.rb +8 -8
  94. data/spec/unit/braintree/successful_result_spec.rb +5 -5
  95. data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
  96. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
  97. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  98. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  99. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
  100. data/spec/unit/braintree/transaction/payment_receipt_spec.rb +73 -0
  101. data/spec/unit/braintree/transaction_gateway_spec.rb +9 -6
  102. data/spec/unit/braintree/transaction_search_spec.rb +2 -2
  103. data/spec/unit/braintree/transaction_spec.rb +101 -93
  104. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  105. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  106. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  107. data/spec/unit/braintree/us_bank_account_verification_spec.rb +7 -7
  108. data/spec/unit/braintree/util_spec.rb +27 -27
  109. data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
  110. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  111. data/spec/unit/braintree/venmo_profile_data_spec.rb +5 -5
  112. data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
  113. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  114. data/spec/unit/braintree/xml/parser_spec.rb +8 -8
  115. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  116. data/spec/unit/braintree/xml_spec.rb +17 -17
  117. data/spec/unit/braintree_spec.rb +2 -2
  118. metadata +7 -2
@@ -19,10 +19,10 @@ describe Braintree::Subscription do
19
19
  :plan_id => SpecHelper::TriallessPlan[:id],
20
20
  )
21
21
 
22
- result.success?.should == true
23
- result.subscription.id.should =~ /^\w{6}$/
24
- result.subscription.status.should == Braintree::Subscription::Status::Active
25
- result.subscription.plan_id.should == "integration_trialless_plan"
22
+ expect(result.success?).to eq(true)
23
+ expect(result.subscription.id).to match(/^\w{6}$/)
24
+ expect(result.subscription.status).to eq(Braintree::Subscription::Status::Active)
25
+ expect(result.subscription.plan_id).to eq("integration_trialless_plan")
26
26
 
27
27
  expect(result.subscription.first_billing_date).to be_a Date
28
28
  expect(result.subscription.next_billing_date).to be_a Date
@@ -30,18 +30,18 @@ describe Braintree::Subscription do
30
30
  expect(result.subscription.billing_period_end_date).to be_a Date
31
31
  expect(result.subscription.paid_through_date).to be_a Date
32
32
 
33
- result.subscription.created_at.between?(Time.now - 60, Time.now).should == true
34
- result.subscription.updated_at.between?(Time.now - 60, Time.now).should == true
33
+ expect(result.subscription.created_at.between?(Time.now - 60, Time.now)).to eq(true)
34
+ expect(result.subscription.updated_at.between?(Time.now - 60, Time.now)).to eq(true)
35
35
 
36
- result.subscription.failure_count.should == 0
37
- result.subscription.next_billing_period_amount.should == "12.34"
38
- result.subscription.payment_method_token.should == @credit_card.token
36
+ expect(result.subscription.failure_count).to eq(0)
37
+ expect(result.subscription.next_billing_period_amount).to eq("12.34")
38
+ expect(result.subscription.payment_method_token).to eq(@credit_card.token)
39
39
 
40
- result.subscription.status_history.first.price.should == "12.34"
41
- result.subscription.status_history.first.status.should == Braintree::Subscription::Status::Active
42
- result.subscription.status_history.first.subscription_source.should == Braintree::Subscription::Source::Api
43
- result.subscription.status_history.first.currency_iso_code.should == "USD"
44
- result.subscription.status_history.first.plan_id.should == SpecHelper::TriallessPlan[:id]
40
+ expect(result.subscription.status_history.first.price).to eq("12.34")
41
+ expect(result.subscription.status_history.first.status).to eq(Braintree::Subscription::Status::Active)
42
+ expect(result.subscription.status_history.first.subscription_source).to eq(Braintree::Subscription::Source::Api)
43
+ expect(result.subscription.status_history.first.currency_iso_code).to eq("USD")
44
+ expect(result.subscription.status_history.first.plan_id).to eq(SpecHelper::TriallessPlan[:id])
45
45
  end
46
46
 
47
47
  it "returns a transaction with billing period populated" do
@@ -50,12 +50,12 @@ describe Braintree::Subscription do
50
50
  :plan_id => SpecHelper::TriallessPlan[:id],
51
51
  )
52
52
 
53
- result.success?.should == true
53
+ expect(result.success?).to eq(true)
54
54
  subscription = result.subscription
55
55
  transaction = subscription.transactions.first
56
56
 
57
- transaction.subscription_details.billing_period_start_date.should == subscription.billing_period_start_date
58
- transaction.subscription_details.billing_period_end_date.should == subscription.billing_period_end_date
57
+ expect(transaction.subscription_details.billing_period_start_date).to eq(subscription.billing_period_start_date)
58
+ expect(transaction.subscription_details.billing_period_end_date).to eq(subscription.billing_period_end_date)
59
59
  end
60
60
 
61
61
  it "can set the id" do
@@ -66,8 +66,8 @@ describe Braintree::Subscription do
66
66
  :id => new_id,
67
67
  )
68
68
 
69
- result.success?.should == true
70
- result.subscription.id.should == new_id
69
+ expect(result.success?).to eq(true)
70
+ expect(result.subscription.id).to eq(new_id)
71
71
  end
72
72
 
73
73
  context "with payment_method_nonces" do
@@ -87,10 +87,10 @@ describe Braintree::Subscription do
87
87
  :plan_id => SpecHelper::TriallessPlan[:id],
88
88
  )
89
89
 
90
- result.success?.should == true
90
+ expect(result.success?).to eq(true)
91
91
  transaction = result.subscription.transactions[0]
92
- transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
93
- transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4, 4]
92
+ expect(transaction.credit_card_details.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
93
+ expect(transaction.credit_card_details.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4, 4])
94
94
  end
95
95
 
96
96
  it "creates a subscription when given a paypal account payment_method_nonce" do
@@ -105,9 +105,9 @@ describe Braintree::Subscription do
105
105
  :plan_id => SpecHelper::TriallessPlan[:id],
106
106
  )
107
107
 
108
- result.should be_success
108
+ expect(result).to be_success
109
109
  transaction = result.subscription.transactions[0]
110
- transaction.paypal_details.payer_email.should == "payer@example.com"
110
+ expect(transaction.paypal_details.payer_email).to eq("payer@example.com")
111
111
  end
112
112
 
113
113
  it "creates a subscription when given a paypal description" do
@@ -127,12 +127,12 @@ describe Braintree::Subscription do
127
127
  },
128
128
  )
129
129
 
130
- result.should be_success
130
+ expect(result).to be_success
131
131
  subscription = result.subscription
132
- subscription.description.should == "A great product"
132
+ expect(subscription.description).to eq("A great product")
133
133
  transaction = subscription.transactions[0]
134
- transaction.paypal_details.payer_email.should == "payer@example.com"
135
- transaction.paypal_details.description.should == "A great product"
134
+ expect(transaction.paypal_details.payer_email).to eq("payer@example.com")
135
+ expect(transaction.paypal_details.description).to eq("A great product")
136
136
  end
137
137
 
138
138
  it "returns an error if the payment_method_nonce hasn't been vaulted" do
@@ -142,8 +142,8 @@ describe Braintree::Subscription do
142
142
  :plan_id => SpecHelper::TriallessPlan[:id],
143
143
  )
144
144
 
145
- result.should_not be_success
146
- result.errors.for(:subscription).on(:payment_method_nonce).first.code.should == "91925"
145
+ expect(result).not_to be_success
146
+ expect(result.errors.for(:subscription).on(:payment_method_nonce).first.code).to eq("91925")
147
147
  end
148
148
  end
149
149
 
@@ -154,8 +154,8 @@ describe Braintree::Subscription do
154
154
  :plan_id => SpecHelper::BillingDayOfMonthPlan[:id],
155
155
  )
156
156
 
157
- result.success?.should == true
158
- result.subscription.billing_day_of_month.should == 5
157
+ expect(result.success?).to eq(true)
158
+ expect(result.subscription.billing_day_of_month).to eq(5)
159
159
  end
160
160
 
161
161
  it "allows overriding" do
@@ -165,8 +165,8 @@ describe Braintree::Subscription do
165
165
  :billing_day_of_month => 25,
166
166
  )
167
167
 
168
- result.success?.should == true
169
- result.subscription.billing_day_of_month.should == 25
168
+ expect(result.success?).to eq(true)
169
+ expect(result.subscription.billing_day_of_month).to eq(25)
170
170
  end
171
171
 
172
172
  it "allows overriding with start_immediately" do
@@ -178,8 +178,8 @@ describe Braintree::Subscription do
178
178
  },
179
179
  )
180
180
 
181
- result.success?.should == true
182
- result.subscription.transactions.size.should == 1
181
+ expect(result.success?).to eq(true)
182
+ expect(result.subscription.transactions.size).to eq(1)
183
183
  end
184
184
  end
185
185
 
@@ -191,9 +191,9 @@ describe Braintree::Subscription do
191
191
  :first_billing_date => Date.today + 3,
192
192
  )
193
193
 
194
- result.success?.should == true
195
- result.subscription.first_billing_date.should == Date.today + 3
196
- result.subscription.status.should == Braintree::Subscription::Status::Pending
194
+ expect(result.success?).to eq(true)
195
+ expect(result.subscription.first_billing_date).to eq(Date.today + 3)
196
+ expect(result.subscription.status).to eq(Braintree::Subscription::Status::Pending)
197
197
  end
198
198
 
199
199
  it "returns an error if the date is in the past" do
@@ -203,8 +203,8 @@ describe Braintree::Subscription do
203
203
  :first_billing_date => Date.today - 3,
204
204
  )
205
205
 
206
- result.success?.should == false
207
- result.errors.for(:subscription).on(:first_billing_date).first.code.should == Braintree::ErrorCodes::Subscription::FirstBillingDateCannotBeInThePast
206
+ expect(result.success?).to eq(false)
207
+ expect(result.errors.for(:subscription).on(:first_billing_date).first.code).to eq(Braintree::ErrorCodes::Subscription::FirstBillingDateCannotBeInThePast)
208
208
  end
209
209
  end
210
210
 
@@ -215,8 +215,8 @@ describe Braintree::Subscription do
215
215
  :plan_id => SpecHelper::TrialPlan[:id],
216
216
  )
217
217
 
218
- result.success?.should == true
219
- result.subscription.merchant_account_id.should == SpecHelper::DefaultMerchantAccountId
218
+ expect(result.success?).to eq(true)
219
+ expect(result.subscription.merchant_account_id).to eq(SpecHelper::DefaultMerchantAccountId)
220
220
  end
221
221
 
222
222
  it "allows setting the merchant_account_id" do
@@ -226,8 +226,8 @@ describe Braintree::Subscription do
226
226
  :merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
227
227
  )
228
228
 
229
- result.success?.should == true
230
- result.subscription.merchant_account_id.should == SpecHelper::NonDefaultMerchantAccountId
229
+ expect(result.success?).to eq(true)
230
+ expect(result.subscription.merchant_account_id).to eq(SpecHelper::NonDefaultMerchantAccountId)
231
231
  end
232
232
  end
233
233
 
@@ -239,8 +239,8 @@ describe Braintree::Subscription do
239
239
  :number_of_billing_cycles => 10,
240
240
  )
241
241
 
242
- result.success?.should == true
243
- result.subscription.number_of_billing_cycles.should == 10
242
+ expect(result.success?).to eq(true)
243
+ expect(result.subscription.number_of_billing_cycles).to eq(10)
244
244
  end
245
245
 
246
246
  it "sets the number of billing cycles to nil if :never_expires => true" do
@@ -250,8 +250,8 @@ describe Braintree::Subscription do
250
250
  :never_expires => true,
251
251
  )
252
252
 
253
- result.success?.should == true
254
- result.subscription.number_of_billing_cycles.should == nil
253
+ expect(result.success?).to eq(true)
254
+ expect(result.subscription.number_of_billing_cycles).to eq(nil)
255
255
  end
256
256
  end
257
257
 
@@ -263,9 +263,9 @@ describe Braintree::Subscription do
263
263
  :plan_id => SpecHelper::TriallessPlan[:id],
264
264
  )
265
265
 
266
- result.subscription.trial_period.should == false
267
- result.subscription.trial_duration.should == nil
268
- result.subscription.trial_duration_unit.should == nil
266
+ expect(result.subscription.trial_period).to eq(false)
267
+ expect(result.subscription.trial_duration).to eq(nil)
268
+ expect(result.subscription.trial_duration_unit).to eq(nil)
269
269
  end
270
270
 
271
271
  it "with a trial" do
@@ -274,9 +274,9 @@ describe Braintree::Subscription do
274
274
  :plan_id => SpecHelper::TrialPlan[:id],
275
275
  )
276
276
 
277
- result.subscription.trial_period.should == true
278
- result.subscription.trial_duration.should == 2
279
- result.subscription.trial_duration_unit.should == Braintree::Subscription::TrialDurationUnit::Day
277
+ expect(result.subscription.trial_period).to eq(true)
278
+ expect(result.subscription.trial_duration).to eq(2)
279
+ expect(result.subscription.trial_duration_unit).to eq(Braintree::Subscription::TrialDurationUnit::Day)
280
280
  end
281
281
 
282
282
  it "can alter the trial period params" do
@@ -287,9 +287,9 @@ describe Braintree::Subscription do
287
287
  :trial_duration_unit => Braintree::Subscription::TrialDurationUnit::Month,
288
288
  )
289
289
 
290
- result.subscription.trial_period.should == true
291
- result.subscription.trial_duration.should == 5
292
- result.subscription.trial_duration_unit.should == Braintree::Subscription::TrialDurationUnit::Month
290
+ expect(result.subscription.trial_period).to eq(true)
291
+ expect(result.subscription.trial_duration).to eq(5)
292
+ expect(result.subscription.trial_duration_unit).to eq(Braintree::Subscription::TrialDurationUnit::Month)
293
293
  end
294
294
 
295
295
  it "can override the trial_period param" do
@@ -299,7 +299,7 @@ describe Braintree::Subscription do
299
299
  :trial_period => false,
300
300
  )
301
301
 
302
- result.subscription.trial_period.should == false
302
+ expect(result.subscription.trial_period).to eq(false)
303
303
  end
304
304
 
305
305
  it "doesn't create a transaction if there's a trial period" do
@@ -308,7 +308,7 @@ describe Braintree::Subscription do
308
308
  :plan_id => SpecHelper::TrialPlan[:id],
309
309
  )
310
310
 
311
- result.subscription.transactions.size.should == 0
311
+ expect(result.subscription.transactions.size).to eq(0)
312
312
  end
313
313
  end
314
314
 
@@ -319,11 +319,11 @@ describe Braintree::Subscription do
319
319
  :plan_id => SpecHelper::TriallessPlan[:id],
320
320
  )
321
321
 
322
- result.subscription.transactions.size.should == 1
323
- result.subscription.transactions.first.should be_a(Braintree::Transaction)
324
- result.subscription.transactions.first.amount.should == SpecHelper::TriallessPlan[:price]
325
- result.subscription.transactions.first.type.should == Braintree::Transaction::Type::Sale
326
- result.subscription.transactions.first.subscription_id.should == result.subscription.id
322
+ expect(result.subscription.transactions.size).to eq(1)
323
+ expect(result.subscription.transactions.first).to be_a(Braintree::Transaction)
324
+ expect(result.subscription.transactions.first.amount).to eq(SpecHelper::TriallessPlan[:price])
325
+ expect(result.subscription.transactions.first.type).to eq(Braintree::Transaction::Type::Sale)
326
+ expect(result.subscription.transactions.first.subscription_id).to eq(result.subscription.id)
327
327
  end
328
328
 
329
329
  it "does not create the subscription and returns the transaction if the transaction is not successful" do
@@ -333,9 +333,9 @@ describe Braintree::Subscription do
333
333
  :price => Braintree::Test::TransactionAmounts::Decline,
334
334
  )
335
335
 
336
- result.success?.should be(false)
337
- result.transaction.status.should == Braintree::Transaction::Status::ProcessorDeclined
338
- result.message.should == "Do Not Honor"
336
+ expect(result.success?).to be(false)
337
+ expect(result.transaction.status).to eq(Braintree::Transaction::Status::ProcessorDeclined)
338
+ expect(result.message).to eq("Do Not Honor")
339
339
  end
340
340
  end
341
341
 
@@ -346,7 +346,7 @@ describe Braintree::Subscription do
346
346
  :plan_id => SpecHelper::TrialPlan[:id],
347
347
  )
348
348
 
349
- result.subscription.price.should == SpecHelper::TrialPlan[:price]
349
+ expect(result.subscription.price).to eq(SpecHelper::TrialPlan[:price])
350
350
  end
351
351
 
352
352
  it "can be overridden" do
@@ -356,7 +356,7 @@ describe Braintree::Subscription do
356
356
  :price => 98.76,
357
357
  )
358
358
 
359
- result.subscription.price.should == BigDecimal("98.76")
359
+ expect(result.subscription.price).to eq(BigDecimal("98.76"))
360
360
  end
361
361
  end
362
362
  end
@@ -368,8 +368,8 @@ describe Braintree::Subscription do
368
368
  :plan_id => SpecHelper::TrialPlan[:id],
369
369
  :id => "invalid token",
370
370
  )
371
- result.success?.should == false
372
- result.errors.for(:subscription).on(:id)[0].message.should == "ID is invalid (use only letters, numbers, '-', and '_')."
371
+ expect(result.success?).to eq(false)
372
+ expect(result.errors.for(:subscription).on(:id)[0].message).to eq("ID is invalid (use only letters, numbers, '-', and '_').")
373
373
  end
374
374
 
375
375
  it "has validation errors on duplicate id" do
@@ -379,15 +379,15 @@ describe Braintree::Subscription do
379
379
  :plan_id => SpecHelper::TrialPlan[:id],
380
380
  :id => duplicate_token,
381
381
  )
382
- result.success?.should == true
382
+ expect(result.success?).to eq(true)
383
383
 
384
384
  result = Braintree::Subscription.create(
385
385
  :payment_method_token => @credit_card.token,
386
386
  :plan_id => SpecHelper::TrialPlan[:id],
387
387
  :id => duplicate_token,
388
388
  )
389
- result.success?.should == false
390
- result.errors.for(:subscription).on(:id)[0].message.should == "ID has already been taken."
389
+ expect(result.success?).to eq(false)
390
+ expect(result.errors.for(:subscription).on(:id)[0].message).to eq("ID has already been taken.")
391
391
  end
392
392
 
393
393
  it "trial duration required" do
@@ -397,8 +397,8 @@ describe Braintree::Subscription do
397
397
  :trial_period => true,
398
398
  :trial_duration => nil,
399
399
  )
400
- result.success?.should == false
401
- result.errors.for(:subscription).on(:trial_duration)[0].message.should == "Trial Duration is required."
400
+ expect(result.success?).to eq(false)
401
+ expect(result.errors.for(:subscription).on(:trial_duration)[0].message).to eq("Trial Duration is required.")
402
402
  end
403
403
 
404
404
  it "trial duration unit required" do
@@ -409,8 +409,8 @@ describe Braintree::Subscription do
409
409
  :trial_duration => 2,
410
410
  :trial_duration_unit => nil,
411
411
  )
412
- result.success?.should == false
413
- result.errors.for(:subscription).on(:trial_duration_unit)[0].message.should == "Trial Duration Unit is invalid."
412
+ expect(result.success?).to eq(false)
413
+ expect(result.errors.for(:subscription).on(:trial_duration_unit)[0].message).to eq("Trial Duration Unit is invalid.")
414
414
  end
415
415
  end
416
416
 
@@ -421,12 +421,12 @@ describe Braintree::Subscription do
421
421
  :plan_id => SpecHelper::AddOnDiscountPlan[:id],
422
422
  :options => {:do_not_inherit_add_ons_or_discounts => true},
423
423
  )
424
- result.success?.should == true
424
+ expect(result.success?).to eq(true)
425
425
 
426
426
  subscription = result.subscription
427
427
 
428
- subscription.add_ons.size.should == 0
429
- subscription.discounts.size.should == 0
428
+ expect(subscription.add_ons.size).to eq(0)
429
+ expect(subscription.discounts.size).to eq(0)
430
430
  end
431
431
 
432
432
  it "inherits the add_ons and discounts from the plan when not specified" do
@@ -434,43 +434,43 @@ describe Braintree::Subscription do
434
434
  :payment_method_token => @credit_card.token,
435
435
  :plan_id => SpecHelper::AddOnDiscountPlan[:id],
436
436
  )
437
- result.success?.should == true
437
+ expect(result.success?).to eq(true)
438
438
 
439
439
  subscription = result.subscription
440
440
 
441
- subscription.add_ons.size.should == 2
441
+ expect(subscription.add_ons.size).to eq(2)
442
442
  add_ons = subscription.add_ons.sort_by { |add_on| add_on.id }
443
443
 
444
- add_ons.first.id.should == "increase_10"
445
- add_ons.first.amount.should == BigDecimal("10.00")
446
- add_ons.first.quantity.should == 1
447
- add_ons.first.number_of_billing_cycles.should be_nil
448
- add_ons.first.never_expires?.should be(true)
449
- add_ons.first.current_billing_cycle.should == 0
450
-
451
- add_ons.last.id.should == "increase_20"
452
- add_ons.last.amount.should == BigDecimal("20.00")
453
- add_ons.last.quantity.should == 1
454
- add_ons.last.number_of_billing_cycles.should be_nil
455
- add_ons.last.never_expires?.should be(true)
456
- add_ons.last.current_billing_cycle.should == 0
457
-
458
- subscription.discounts.size.should == 2
444
+ expect(add_ons.first.id).to eq("increase_10")
445
+ expect(add_ons.first.amount).to eq(BigDecimal("10.00"))
446
+ expect(add_ons.first.quantity).to eq(1)
447
+ expect(add_ons.first.number_of_billing_cycles).to be_nil
448
+ expect(add_ons.first.never_expires?).to be(true)
449
+ expect(add_ons.first.current_billing_cycle).to eq(0)
450
+
451
+ expect(add_ons.last.id).to eq("increase_20")
452
+ expect(add_ons.last.amount).to eq(BigDecimal("20.00"))
453
+ expect(add_ons.last.quantity).to eq(1)
454
+ expect(add_ons.last.number_of_billing_cycles).to be_nil
455
+ expect(add_ons.last.never_expires?).to be(true)
456
+ expect(add_ons.last.current_billing_cycle).to eq(0)
457
+
458
+ expect(subscription.discounts.size).to eq(2)
459
459
  discounts = subscription.discounts.sort_by { |discount| discount.id }
460
460
 
461
- discounts.first.id.should == "discount_11"
462
- discounts.first.amount.should == BigDecimal("11.00")
463
- discounts.first.quantity.should == 1
464
- discounts.first.number_of_billing_cycles.should be_nil
465
- discounts.first.never_expires?.should be(true)
466
- discounts.first.current_billing_cycle.should == 0
461
+ expect(discounts.first.id).to eq("discount_11")
462
+ expect(discounts.first.amount).to eq(BigDecimal("11.00"))
463
+ expect(discounts.first.quantity).to eq(1)
464
+ expect(discounts.first.number_of_billing_cycles).to be_nil
465
+ expect(discounts.first.never_expires?).to be(true)
466
+ expect(discounts.first.current_billing_cycle).to eq(0)
467
467
 
468
- discounts.last.id.should == "discount_7"
469
- discounts.last.amount.should == BigDecimal("7.00")
470
- discounts.last.quantity.should == 1
471
- discounts.last.number_of_billing_cycles.should be_nil
472
- discounts.last.never_expires?.should be(true)
473
- discounts.last.current_billing_cycle.should == 0
468
+ expect(discounts.last.id).to eq("discount_7")
469
+ expect(discounts.last.amount).to eq(BigDecimal("7.00"))
470
+ expect(discounts.last.quantity).to eq(1)
471
+ expect(discounts.last.number_of_billing_cycles).to be_nil
472
+ expect(discounts.last.never_expires?).to be(true)
473
+ expect(discounts.last.current_billing_cycle).to eq(0)
474
474
  end
475
475
 
476
476
  it "allows overriding of inherited add_ons and discounts" do
@@ -498,39 +498,39 @@ describe Braintree::Subscription do
498
498
  ]
499
499
  },
500
500
  )
501
- result.success?.should == true
501
+ expect(result.success?).to eq(true)
502
502
 
503
503
  subscription = result.subscription
504
504
 
505
- subscription.add_ons.size.should == 2
505
+ expect(subscription.add_ons.size).to eq(2)
506
506
  add_ons = subscription.add_ons.sort_by { |add_on| add_on.id }
507
507
 
508
- add_ons.first.id.should == "increase_10"
509
- add_ons.first.amount.should == BigDecimal("50.00")
510
- add_ons.first.quantity.should == 2
511
- add_ons.first.number_of_billing_cycles.should == 5
512
- add_ons.first.never_expires?.should be(false)
513
- add_ons.first.current_billing_cycle.should == 0
508
+ expect(add_ons.first.id).to eq("increase_10")
509
+ expect(add_ons.first.amount).to eq(BigDecimal("50.00"))
510
+ expect(add_ons.first.quantity).to eq(2)
511
+ expect(add_ons.first.number_of_billing_cycles).to eq(5)
512
+ expect(add_ons.first.never_expires?).to be(false)
513
+ expect(add_ons.first.current_billing_cycle).to eq(0)
514
514
 
515
- add_ons.last.id.should == "increase_20"
516
- add_ons.last.amount.should == BigDecimal("20.00")
517
- add_ons.last.quantity.should == 1
518
- add_ons.last.current_billing_cycle.should == 0
515
+ expect(add_ons.last.id).to eq("increase_20")
516
+ expect(add_ons.last.amount).to eq(BigDecimal("20.00"))
517
+ expect(add_ons.last.quantity).to eq(1)
518
+ expect(add_ons.last.current_billing_cycle).to eq(0)
519
519
 
520
- subscription.discounts.size.should == 2
520
+ expect(subscription.discounts.size).to eq(2)
521
521
  discounts = subscription.discounts.sort_by { |discount| discount.id }
522
522
 
523
- discounts.first.id.should == "discount_11"
524
- discounts.first.amount.should == BigDecimal("11.00")
525
- discounts.first.quantity.should == 1
526
- discounts.first.current_billing_cycle.should == 0
523
+ expect(discounts.first.id).to eq("discount_11")
524
+ expect(discounts.first.amount).to eq(BigDecimal("11.00"))
525
+ expect(discounts.first.quantity).to eq(1)
526
+ expect(discounts.first.current_billing_cycle).to eq(0)
527
527
 
528
- discounts.last.id.should == "discount_7"
529
- discounts.last.amount.should == BigDecimal("15.00")
530
- discounts.last.quantity.should == 3
531
- discounts.last.number_of_billing_cycles.should be_nil
532
- discounts.last.never_expires?.should be(true)
533
- discounts.last.current_billing_cycle.should == 0
528
+ expect(discounts.last.id).to eq("discount_7")
529
+ expect(discounts.last.amount).to eq(BigDecimal("15.00"))
530
+ expect(discounts.last.quantity).to eq(3)
531
+ expect(discounts.last.number_of_billing_cycles).to be_nil
532
+ expect(discounts.last.never_expires?).to be(true)
533
+ expect(discounts.last.current_billing_cycle).to eq(0)
534
534
  end
535
535
 
536
536
  it "allows deleting of inherited add_ons and discounts" do
@@ -544,21 +544,21 @@ describe Braintree::Subscription do
544
544
  :remove => [SpecHelper::Discount7]
545
545
  },
546
546
  )
547
- result.success?.should == true
547
+ expect(result.success?).to eq(true)
548
548
 
549
549
  subscription = result.subscription
550
550
 
551
- subscription.add_ons.size.should == 1
552
- subscription.add_ons.first.id.should == "increase_20"
553
- subscription.add_ons.first.amount.should == BigDecimal("20.00")
554
- subscription.add_ons.first.quantity.should == 1
555
- subscription.add_ons.first.current_billing_cycle.should == 0
551
+ expect(subscription.add_ons.size).to eq(1)
552
+ expect(subscription.add_ons.first.id).to eq("increase_20")
553
+ expect(subscription.add_ons.first.amount).to eq(BigDecimal("20.00"))
554
+ expect(subscription.add_ons.first.quantity).to eq(1)
555
+ expect(subscription.add_ons.first.current_billing_cycle).to eq(0)
556
556
 
557
- subscription.discounts.size.should == 1
558
- subscription.discounts.last.id.should == "discount_11"
559
- subscription.discounts.last.amount.should == BigDecimal("11.00")
560
- subscription.discounts.last.quantity.should == 1
561
- subscription.discounts.last.current_billing_cycle.should == 0
557
+ expect(subscription.discounts.size).to eq(1)
558
+ expect(subscription.discounts.last.id).to eq("discount_11")
559
+ expect(subscription.discounts.last.amount).to eq(BigDecimal("11.00"))
560
+ expect(subscription.discounts.last.quantity).to eq(1)
561
+ expect(subscription.discounts.last.current_billing_cycle).to eq(0)
562
562
  end
563
563
 
564
564
  it "allows adding new add_ons and discounts" do
@@ -572,38 +572,38 @@ describe Braintree::Subscription do
572
572
  :add => [{:inherited_from_id => SpecHelper::Discount15}]
573
573
  },
574
574
  )
575
- result.success?.should == true
575
+ expect(result.success?).to eq(true)
576
576
  subscription = result.subscription
577
577
 
578
- subscription.add_ons.size.should == 3
578
+ expect(subscription.add_ons.size).to eq(3)
579
579
  add_ons = subscription.add_ons.sort_by { |add_on| add_on.id }
580
580
 
581
- add_ons[0].id.should == "increase_10"
582
- add_ons[0].amount.should == BigDecimal("10.00")
583
- add_ons[0].quantity.should == 1
581
+ expect(add_ons[0].id).to eq("increase_10")
582
+ expect(add_ons[0].amount).to eq(BigDecimal("10.00"))
583
+ expect(add_ons[0].quantity).to eq(1)
584
584
 
585
- add_ons[1].id.should == "increase_20"
586
- add_ons[1].amount.should == BigDecimal("20.00")
587
- add_ons[1].quantity.should == 1
585
+ expect(add_ons[1].id).to eq("increase_20")
586
+ expect(add_ons[1].amount).to eq(BigDecimal("20.00"))
587
+ expect(add_ons[1].quantity).to eq(1)
588
588
 
589
- add_ons[2].id.should == "increase_30"
590
- add_ons[2].amount.should == BigDecimal("30.00")
591
- add_ons[2].quantity.should == 1
589
+ expect(add_ons[2].id).to eq("increase_30")
590
+ expect(add_ons[2].amount).to eq(BigDecimal("30.00"))
591
+ expect(add_ons[2].quantity).to eq(1)
592
592
 
593
- subscription.discounts.size.should == 3
593
+ expect(subscription.discounts.size).to eq(3)
594
594
  discounts = subscription.discounts.sort_by { |discount| discount.id }
595
595
 
596
- discounts[0].id.should == "discount_11"
597
- discounts[0].amount.should == BigDecimal("11.00")
598
- discounts[0].quantity.should == 1
596
+ expect(discounts[0].id).to eq("discount_11")
597
+ expect(discounts[0].amount).to eq(BigDecimal("11.00"))
598
+ expect(discounts[0].quantity).to eq(1)
599
599
 
600
- discounts[1].id.should == "discount_15"
601
- discounts[1].amount.should == BigDecimal("15.00")
602
- discounts[1].quantity.should == 1
600
+ expect(discounts[1].id).to eq("discount_15")
601
+ expect(discounts[1].amount).to eq(BigDecimal("15.00"))
602
+ expect(discounts[1].quantity).to eq(1)
603
603
 
604
- discounts[2].id.should == "discount_7"
605
- discounts[2].amount.should == BigDecimal("7.00")
606
- discounts[2].quantity.should == 1
604
+ expect(discounts[2].id).to eq("discount_7")
605
+ expect(discounts[2].amount).to eq(BigDecimal("7.00"))
606
+ expect(discounts[2].quantity).to eq(1)
607
607
  end
608
608
 
609
609
  it "properly parses validation errors for arrays" do
@@ -623,9 +623,9 @@ describe Braintree::Subscription do
623
623
  ]
624
624
  },
625
625
  )
626
- result.success?.should == false
627
- result.errors.for(:subscription).for(:add_ons).for(:update).for_index(0).on(:amount)[0].code.should == Braintree::ErrorCodes::Subscription::Modification::AmountIsInvalid
628
- result.errors.for(:subscription).for(:add_ons).for(:update).for_index(1).on(:quantity)[0].code.should == Braintree::ErrorCodes::Subscription::Modification::QuantityIsInvalid
626
+ expect(result.success?).to eq(false)
627
+ expect(result.errors.for(:subscription).for(:add_ons).for(:update).for_index(0).on(:amount)[0].code).to eq(Braintree::ErrorCodes::Subscription::Modification::AmountIsInvalid)
628
+ expect(result.errors.for(:subscription).for(:add_ons).for(:update).for_index(1).on(:quantity)[0].code).to eq(Braintree::ErrorCodes::Subscription::Modification::QuantityIsInvalid)
629
629
  end
630
630
  end
631
631
 
@@ -640,14 +640,14 @@ describe Braintree::Subscription do
640
640
  },
641
641
  )
642
642
 
643
- result.success?.should == true
644
- result.subscription.descriptor.name.should == "123*123456789012345678"
645
- result.subscription.descriptor.phone.should == "3334445555"
643
+ expect(result.success?).to eq(true)
644
+ expect(result.subscription.descriptor.name).to eq("123*123456789012345678")
645
+ expect(result.subscription.descriptor.phone).to eq("3334445555")
646
646
 
647
- result.subscription.transactions.size.should == 1
647
+ expect(result.subscription.transactions.size).to eq(1)
648
648
  transaction = result.subscription.transactions.first
649
- transaction.descriptor.name.should == "123*123456789012345678"
650
- transaction.descriptor.phone.should == "3334445555"
649
+ expect(transaction.descriptor.name).to eq("123*123456789012345678")
650
+ expect(transaction.descriptor.phone).to eq("3334445555")
651
651
  end
652
652
 
653
653
  it "has validation errors if format is invalid" do
@@ -660,10 +660,10 @@ describe Braintree::Subscription do
660
660
  :url => "12345678901234"
661
661
  },
662
662
  )
663
- result.success?.should == false
664
- result.errors.for(:subscription).for(:descriptor).on(:name)[0].code.should == Braintree::ErrorCodes::Descriptor::NameFormatIsInvalid
665
- result.errors.for(:subscription).for(:descriptor).on(:phone)[0].code.should == Braintree::ErrorCodes::Descriptor::PhoneFormatIsInvalid
666
- result.errors.for(:subscription).for(:descriptor).on(:url)[0].code.should == Braintree::ErrorCodes::Descriptor::UrlFormatIsInvalid
663
+ expect(result.success?).to eq(false)
664
+ expect(result.errors.for(:subscription).for(:descriptor).on(:name)[0].code).to eq(Braintree::ErrorCodes::Descriptor::NameFormatIsInvalid)
665
+ expect(result.errors.for(:subscription).for(:descriptor).on(:phone)[0].code).to eq(Braintree::ErrorCodes::Descriptor::PhoneFormatIsInvalid)
666
+ expect(result.errors.for(:subscription).for(:descriptor).on(:url)[0].code).to eq(Braintree::ErrorCodes::Descriptor::UrlFormatIsInvalid)
667
667
  end
668
668
  end
669
669
  end
@@ -675,9 +675,9 @@ describe Braintree::Subscription do
675
675
  :plan_id => SpecHelper::TriallessPlan[:id],
676
676
  )
677
677
 
678
- subscription.id.should =~ /^\w{6}$/
679
- subscription.status.should == Braintree::Subscription::Status::Active
680
- subscription.plan_id.should == "integration_trialless_plan"
678
+ expect(subscription.id).to match(/^\w{6}$/)
679
+ expect(subscription.status).to eq(Braintree::Subscription::Status::Active)
680
+ expect(subscription.plan_id).to eq("integration_trialless_plan")
681
681
 
682
682
  expect(subscription.first_billing_date).to be_a Date
683
683
  expect(subscription.next_billing_date).to be_a Date
@@ -685,10 +685,10 @@ describe Braintree::Subscription do
685
685
  expect(subscription.billing_period_end_date).to be_a Date
686
686
  expect(subscription.paid_through_date).to be_a Date
687
687
 
688
- subscription.failure_count.should == 0
689
- subscription.current_billing_cycle.should == 1
690
- subscription.next_billing_period_amount.should == "12.34"
691
- subscription.payment_method_token.should == @credit_card.token
688
+ expect(subscription.failure_count).to eq(0)
689
+ expect(subscription.current_billing_cycle).to eq(1)
690
+ expect(subscription.next_billing_period_amount).to eq("12.34")
691
+ expect(subscription.payment_method_token).to eq(@credit_card.token)
692
692
  end
693
693
 
694
694
  it "raises a ValidationsFailed if invalid" do
@@ -707,9 +707,9 @@ describe Braintree::Subscription do
707
707
  :payment_method_token => @credit_card.token,
708
708
  :plan_id => SpecHelper::TrialPlan[:id],
709
709
  )
710
- result.success?.should == true
710
+ expect(result.success?).to eq(true)
711
711
 
712
- Braintree::Subscription.find(result.subscription.id).should == result.subscription
712
+ expect(Braintree::Subscription.find(result.subscription.id)).to eq(result.subscription)
713
713
  end
714
714
 
715
715
  it "raises Braintree::NotFoundError if it cannot find" do
@@ -733,8 +733,8 @@ describe Braintree::Subscription do
733
733
  :merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
734
734
  )
735
735
 
736
- result.success?.should == true
737
- result.subscription.merchant_account_id.should == SpecHelper::NonDefaultMerchantAccountId
736
+ expect(result.success?).to eq(true)
737
+ expect(result.subscription.merchant_account_id).to eq(SpecHelper::NonDefaultMerchantAccountId)
738
738
  end
739
739
 
740
740
  it "allows changing the payment method by payment_method_token" do
@@ -748,7 +748,7 @@ describe Braintree::Subscription do
748
748
  :payment_method_token => new_credit_card.token,
749
749
  )
750
750
 
751
- result.subscription.payment_method_token.should == new_credit_card.token
751
+ expect(result.subscription.payment_method_token).to eq(new_credit_card.token)
752
752
  end
753
753
 
754
754
  it "allows changing the payment_method by payment_method_nonce" do
@@ -763,8 +763,8 @@ describe Braintree::Subscription do
763
763
  )
764
764
 
765
765
  result = Braintree::Subscription.update(@subscription.id, :payment_method_nonce => nonce)
766
- result.subscription.transactions[0].credit_card_details.token.should == @credit_card.token
767
- result.subscription.payment_method_token.should_not == @credit_card.token
766
+ expect(result.subscription.transactions[0].credit_card_details.token).to eq(@credit_card.token)
767
+ expect(result.subscription.payment_method_token).not_to eq(@credit_card.token)
768
768
  end
769
769
 
770
770
  it "allows changing the descriptors" do
@@ -776,10 +776,10 @@ describe Braintree::Subscription do
776
776
  },
777
777
  )
778
778
 
779
- result.success?.should == true
780
- result.subscription.descriptor.name.should == "aaa*1234"
781
- result.subscription.descriptor.phone.should == "3334443333"
782
- result.subscription.descriptor.url.should == "ebay.com"
779
+ expect(result.success?).to eq(true)
780
+ expect(result.subscription.descriptor.name).to eq("aaa*1234")
781
+ expect(result.subscription.descriptor.phone).to eq("3334443333")
782
+ expect(result.subscription.descriptor.url).to eq("ebay.com")
783
783
  end
784
784
 
785
785
  it "allows changing the paypal description" do
@@ -803,8 +803,8 @@ describe Braintree::Subscription do
803
803
  },
804
804
  )
805
805
 
806
- result.success?.should == true
807
- result.subscription.description.should == "A great product"
806
+ expect(result.success?).to eq(true)
807
+ expect(result.subscription.description).to eq("A great product")
808
808
  end
809
809
 
810
810
  context "when successful" do
@@ -816,10 +816,10 @@ describe Braintree::Subscription do
816
816
  :plan_id => SpecHelper::TrialPlan[:id],
817
817
  )
818
818
 
819
- result.success?.should == true
820
- result.subscription.id.should =~ /#{new_id}/
821
- result.subscription.plan_id.should == SpecHelper::TrialPlan[:id]
822
- result.subscription.price.should == BigDecimal("9999.88")
819
+ expect(result.success?).to eq(true)
820
+ expect(result.subscription.id).to match(/#{new_id}/)
821
+ expect(result.subscription.plan_id).to eq(SpecHelper::TrialPlan[:id])
822
+ expect(result.subscription.price).to eq(BigDecimal("9999.88"))
823
823
  end
824
824
 
825
825
  context "proration" do
@@ -828,9 +828,9 @@ describe Braintree::Subscription do
828
828
  :price => @subscription.price.to_f + 1,
829
829
  )
830
830
 
831
- result.success?.should == true
832
- result.subscription.price.to_f.should == @subscription.price.to_f + 1
833
- result.subscription.transactions.size.should == @subscription.transactions.size + 1
831
+ expect(result.success?).to eq(true)
832
+ expect(result.subscription.price.to_f).to eq(@subscription.price.to_f + 1)
833
+ expect(result.subscription.transactions.size).to eq(@subscription.transactions.size + 1)
834
834
  end
835
835
 
836
836
  it "allows the user to force proration if there is a charge" do
@@ -839,9 +839,9 @@ describe Braintree::Subscription do
839
839
  :options => {:prorate_charges => true},
840
840
  )
841
841
 
842
- result.success?.should == true
843
- result.subscription.price.to_f.should == @subscription.price.to_f + 1
844
- result.subscription.transactions.size.should == @subscription.transactions.size + 1
842
+ expect(result.success?).to eq(true)
843
+ expect(result.subscription.price.to_f).to eq(@subscription.price.to_f + 1)
844
+ expect(result.subscription.transactions.size).to eq(@subscription.transactions.size + 1)
845
845
  end
846
846
 
847
847
  it "allows the user to prevent proration if there is a charge" do
@@ -850,9 +850,9 @@ describe Braintree::Subscription do
850
850
  :options => {:prorate_charges => false},
851
851
  )
852
852
 
853
- result.success?.should == true
854
- result.subscription.price.to_f.should == @subscription.price.to_f + 1
855
- result.subscription.transactions.size.should == @subscription.transactions.size
853
+ expect(result.success?).to eq(true)
854
+ expect(result.subscription.price.to_f).to eq(@subscription.price.to_f + 1)
855
+ expect(result.subscription.transactions.size).to eq(@subscription.transactions.size)
856
856
  end
857
857
 
858
858
  it "doesn't prorate if price decreases" do
@@ -860,9 +860,9 @@ describe Braintree::Subscription do
860
860
  :price => @subscription.price.to_f - 1,
861
861
  )
862
862
 
863
- result.success?.should == true
864
- result.subscription.price.to_f.should == @subscription.price.to_f - 1
865
- result.subscription.transactions.size.should == @subscription.transactions.size
863
+ expect(result.success?).to eq(true)
864
+ expect(result.subscription.price.to_f).to eq(@subscription.price.to_f - 1)
865
+ expect(result.subscription.transactions.size).to eq(@subscription.transactions.size)
866
866
  end
867
867
 
868
868
  it "updates the subscription if the proration fails and revert_subscription_on_proration_failure => false" do
@@ -873,13 +873,13 @@ describe Braintree::Subscription do
873
873
  },
874
874
  )
875
875
 
876
- result.success?.should == true
877
- result.subscription.price.to_f.should == @subscription.price.to_f + 2100
876
+ expect(result.success?).to eq(true)
877
+ expect(result.subscription.price.to_f).to eq(@subscription.price.to_f + 2100)
878
878
 
879
- result.subscription.transactions.size.should == @subscription.transactions.size + 1
879
+ expect(result.subscription.transactions.size).to eq(@subscription.transactions.size + 1)
880
880
  transaction = result.subscription.transactions.first
881
- transaction.status.should == Braintree::Transaction::Status::ProcessorDeclined
882
- result.subscription.balance.should == transaction.amount
881
+ expect(transaction.status).to eq(Braintree::Transaction::Status::ProcessorDeclined)
882
+ expect(result.subscription.balance).to eq(transaction.amount)
883
883
  end
884
884
 
885
885
  it "does not update the subscription if the proration fails and revert_subscription_on_proration_failure => true" do
@@ -890,13 +890,13 @@ describe Braintree::Subscription do
890
890
  },
891
891
  )
892
892
 
893
- result.success?.should == false
894
- result.subscription.price.to_f.should == @subscription.price.to_f
893
+ expect(result.success?).to eq(false)
894
+ expect(result.subscription.price.to_f).to eq(@subscription.price.to_f)
895
895
 
896
- result.subscription.transactions.size.should == @subscription.transactions.size + 1
896
+ expect(result.subscription.transactions.size).to eq(@subscription.transactions.size + 1)
897
897
  transaction = result.subscription.transactions.first
898
- transaction.status.should == Braintree::Transaction::Status::ProcessorDeclined
899
- result.subscription.balance.should == 0
898
+ expect(transaction.status).to eq(Braintree::Transaction::Status::ProcessorDeclined)
899
+ expect(result.subscription.balance).to eq(0)
900
900
  end
901
901
  end
902
902
  end
@@ -919,20 +919,20 @@ describe Braintree::Subscription do
919
919
 
920
920
  it "has validation errors on id" do
921
921
  result = Braintree::Subscription.update(@subscription.id, :id => "invalid token")
922
- result.success?.should == false
923
- result.errors.for(:subscription).on(:id)[0].code.should == Braintree::ErrorCodes::Subscription::TokenFormatIsInvalid
922
+ expect(result.success?).to eq(false)
923
+ expect(result.errors.for(:subscription).on(:id)[0].code).to eq(Braintree::ErrorCodes::Subscription::TokenFormatIsInvalid)
924
924
  end
925
925
 
926
926
  it "has a price" do
927
927
  result = Braintree::Subscription.update(@subscription.id, :price => "")
928
- result.success?.should == false
929
- result.errors.for(:subscription).on(:price)[0].code.should == Braintree::ErrorCodes::Subscription::PriceCannotBeBlank
928
+ expect(result.success?).to eq(false)
929
+ expect(result.errors.for(:subscription).on(:price)[0].code).to eq(Braintree::ErrorCodes::Subscription::PriceCannotBeBlank)
930
930
  end
931
931
 
932
932
  it "has a properly formatted price" do
933
933
  result = Braintree::Subscription.update(@subscription.id, :price => "9.2.1 apples")
934
- result.success?.should == false
935
- result.errors.for(:subscription).on(:price)[0].code.should == Braintree::ErrorCodes::Subscription::PriceFormatIsInvalid
934
+ expect(result.success?).to eq(false)
935
+ expect(result.errors.for(:subscription).on(:price)[0].code).to eq(Braintree::ErrorCodes::Subscription::PriceFormatIsInvalid)
936
936
  end
937
937
 
938
938
  it "has validation errors on duplicate id" do
@@ -946,8 +946,8 @@ describe Braintree::Subscription do
946
946
  @subscription.id,
947
947
  :id => duplicate_id,
948
948
  )
949
- result.success?.should == false
950
- result.errors.for(:subscription).on(:id)[0].code.should == Braintree::ErrorCodes::Subscription::IdIsInUse
949
+ expect(result.success?).to eq(false)
950
+ expect(result.errors.for(:subscription).on(:id)[0].code).to eq(Braintree::ErrorCodes::Subscription::IdIsInUse)
951
951
  end
952
952
 
953
953
  it "cannot update a canceled subscription" do
@@ -958,13 +958,13 @@ describe Braintree::Subscription do
958
958
  ).subscription
959
959
 
960
960
  result = Braintree::Subscription.cancel(subscription.id)
961
- result.success?.should == true
961
+ expect(result.success?).to eq(true)
962
962
 
963
963
  result = Braintree::Subscription.update(subscription.id,
964
964
  :price => 123.45,
965
965
  )
966
- result.success?.should == false
967
- result.errors.for(:subscription)[0].code.should == Braintree::ErrorCodes::Subscription::CannotEditCanceledSubscription
966
+ expect(result.success?).to eq(false)
967
+ expect(result.errors.for(:subscription)[0].code).to eq(Braintree::ErrorCodes::Subscription::CannotEditCanceledSubscription)
968
968
  end
969
969
  end
970
970
 
@@ -981,7 +981,7 @@ describe Braintree::Subscription do
981
981
  :number_of_billing_cycles => 5,
982
982
  )
983
983
 
984
- result.subscription.number_of_billing_cycles.should == 5
984
+ expect(result.subscription.number_of_billing_cycles).to eq(5)
985
985
  end
986
986
 
987
987
  it "sets the number of billing cycles to nil if :never_expires => true" do
@@ -996,9 +996,9 @@ describe Braintree::Subscription do
996
996
  :never_expires => true,
997
997
  )
998
998
 
999
- result.success?.should == true
1000
- result.subscription.number_of_billing_cycles.should == nil
1001
- result.subscription.never_expires?.should be(true)
999
+ expect(result.success?).to eq(true)
1000
+ expect(result.subscription.number_of_billing_cycles).to eq(nil)
1001
+ expect(result.subscription.never_expires?).to be(true)
1002
1002
  end
1003
1003
  end
1004
1004
 
@@ -1008,7 +1008,7 @@ describe Braintree::Subscription do
1008
1008
  :payment_method_token => @credit_card.token,
1009
1009
  :plan_id => SpecHelper::AddOnDiscountPlan[:id],
1010
1010
  )
1011
- result.success?.should == true
1011
+ expect(result.success?).to eq(true)
1012
1012
  subscription = result.subscription
1013
1013
 
1014
1014
  result = Braintree::Subscription.update(
@@ -1035,17 +1035,17 @@ describe Braintree::Subscription do
1035
1035
 
1036
1036
  subscription = result.subscription
1037
1037
 
1038
- subscription.add_ons.size.should == 2
1038
+ expect(subscription.add_ons.size).to eq(2)
1039
1039
  add_ons = subscription.add_ons.sort_by { |add_on| add_on.id }
1040
1040
 
1041
- add_ons.first.amount.should == BigDecimal("99.99")
1042
- add_ons.first.quantity.should == 12
1041
+ expect(add_ons.first.amount).to eq(BigDecimal("99.99"))
1042
+ expect(add_ons.first.quantity).to eq(12)
1043
1043
 
1044
- subscription.discounts.size.should == 2
1044
+ expect(subscription.discounts.size).to eq(2)
1045
1045
  discounts = subscription.discounts.sort_by { |discount| discount.id }
1046
1046
 
1047
- discounts.last.amount.should == BigDecimal("88.88")
1048
- discounts.last.quantity.should == 9
1047
+ expect(discounts.last.amount).to eq(BigDecimal("88.88"))
1048
+ expect(discounts.last.quantity).to eq(9)
1049
1049
  end
1050
1050
 
1051
1051
  it "allows adding new add_ons and discounts" do
@@ -1063,38 +1063,38 @@ describe Braintree::Subscription do
1063
1063
  },
1064
1064
  )
1065
1065
 
1066
- result.success?.should == true
1066
+ expect(result.success?).to eq(true)
1067
1067
  subscription = result.subscription
1068
1068
 
1069
- subscription.add_ons.size.should == 3
1069
+ expect(subscription.add_ons.size).to eq(3)
1070
1070
  add_ons = subscription.add_ons.sort_by { |add_on| add_on.id }
1071
1071
 
1072
- add_ons[0].id.should == "increase_10"
1073
- add_ons[0].amount.should == BigDecimal("10.00")
1074
- add_ons[0].quantity.should == 1
1072
+ expect(add_ons[0].id).to eq("increase_10")
1073
+ expect(add_ons[0].amount).to eq(BigDecimal("10.00"))
1074
+ expect(add_ons[0].quantity).to eq(1)
1075
1075
 
1076
- add_ons[1].id.should == "increase_20"
1077
- add_ons[1].amount.should == BigDecimal("20.00")
1078
- add_ons[1].quantity.should == 1
1076
+ expect(add_ons[1].id).to eq("increase_20")
1077
+ expect(add_ons[1].amount).to eq(BigDecimal("20.00"))
1078
+ expect(add_ons[1].quantity).to eq(1)
1079
1079
 
1080
- add_ons[2].id.should == "increase_30"
1081
- add_ons[2].amount.should == BigDecimal("30.00")
1082
- add_ons[2].quantity.should == 1
1080
+ expect(add_ons[2].id).to eq("increase_30")
1081
+ expect(add_ons[2].amount).to eq(BigDecimal("30.00"))
1082
+ expect(add_ons[2].quantity).to eq(1)
1083
1083
 
1084
- subscription.discounts.size.should == 3
1084
+ expect(subscription.discounts.size).to eq(3)
1085
1085
  discounts = subscription.discounts.sort_by { |discount| discount.id }
1086
1086
 
1087
- discounts[0].id.should == "discount_11"
1088
- discounts[0].amount.should == BigDecimal("11.00")
1089
- discounts[0].quantity.should == 1
1087
+ expect(discounts[0].id).to eq("discount_11")
1088
+ expect(discounts[0].amount).to eq(BigDecimal("11.00"))
1089
+ expect(discounts[0].quantity).to eq(1)
1090
1090
 
1091
- discounts[1].id.should == "discount_15"
1092
- discounts[1].amount.should == BigDecimal("15.00")
1093
- discounts[1].quantity.should == 1
1091
+ expect(discounts[1].id).to eq("discount_15")
1092
+ expect(discounts[1].amount).to eq(BigDecimal("15.00"))
1093
+ expect(discounts[1].quantity).to eq(1)
1094
1094
 
1095
- discounts[2].id.should == "discount_7"
1096
- discounts[2].amount.should == BigDecimal("7.00")
1097
- discounts[2].quantity.should == 1
1095
+ expect(discounts[2].id).to eq("discount_7")
1096
+ expect(discounts[2].amount).to eq(BigDecimal("7.00"))
1097
+ expect(discounts[2].quantity).to eq(1)
1098
1098
  end
1099
1099
 
1100
1100
  it "allows replacing entire set of add_ons and discounts" do
@@ -1113,18 +1113,18 @@ describe Braintree::Subscription do
1113
1113
  :options => {:replace_all_add_ons_and_discounts => true},
1114
1114
  )
1115
1115
 
1116
- result.success?.should == true
1116
+ expect(result.success?).to eq(true)
1117
1117
  subscription = result.subscription
1118
1118
 
1119
- subscription.add_ons.size.should == 1
1119
+ expect(subscription.add_ons.size).to eq(1)
1120
1120
 
1121
- subscription.add_ons[0].amount.should == BigDecimal("30.00")
1122
- subscription.add_ons[0].quantity.should == 1
1121
+ expect(subscription.add_ons[0].amount).to eq(BigDecimal("30.00"))
1122
+ expect(subscription.add_ons[0].quantity).to eq(1)
1123
1123
 
1124
- subscription.discounts.size.should == 1
1124
+ expect(subscription.discounts.size).to eq(1)
1125
1125
 
1126
- subscription.discounts[0].amount.should == BigDecimal("15.00")
1127
- subscription.discounts[0].quantity.should == 1
1126
+ expect(subscription.discounts[0].amount).to eq(BigDecimal("15.00"))
1127
+ expect(subscription.discounts[0].quantity).to eq(1)
1128
1128
  end
1129
1129
 
1130
1130
  it "allows deleting of add_ons and discounts" do
@@ -1141,17 +1141,17 @@ describe Braintree::Subscription do
1141
1141
  :remove => [SpecHelper::Discount7]
1142
1142
  },
1143
1143
  )
1144
- result.success?.should == true
1144
+ expect(result.success?).to eq(true)
1145
1145
 
1146
1146
  subscription = result.subscription
1147
1147
 
1148
- subscription.add_ons.size.should == 1
1149
- subscription.add_ons.first.amount.should == BigDecimal("20.00")
1150
- subscription.add_ons.first.quantity.should == 1
1148
+ expect(subscription.add_ons.size).to eq(1)
1149
+ expect(subscription.add_ons.first.amount).to eq(BigDecimal("20.00"))
1150
+ expect(subscription.add_ons.first.quantity).to eq(1)
1151
1151
 
1152
- subscription.discounts.size.should == 1
1153
- subscription.discounts.last.amount.should == BigDecimal("11.00")
1154
- subscription.discounts.last.quantity.should == 1
1152
+ expect(subscription.discounts.size).to eq(1)
1153
+ expect(subscription.discounts.last.amount).to eq(BigDecimal("11.00"))
1154
+ expect(subscription.discounts.last.quantity).to eq(1)
1155
1155
  end
1156
1156
  end
1157
1157
  end
@@ -1173,9 +1173,9 @@ describe Braintree::Subscription do
1173
1173
  :plan_id => SpecHelper::TrialPlan[:id],
1174
1174
  )
1175
1175
 
1176
- subscription.id.should =~ /#{new_id}/
1177
- subscription.plan_id.should == SpecHelper::TrialPlan[:id]
1178
- subscription.price.should == BigDecimal("9999.88")
1176
+ expect(subscription.id).to match(/#{new_id}/)
1177
+ expect(subscription.plan_id).to eq(SpecHelper::TrialPlan[:id])
1178
+ expect(subscription.price).to eq(BigDecimal("9999.88"))
1179
1179
  end
1180
1180
 
1181
1181
  it "raises a ValidationsFailed if invalid" do
@@ -1197,8 +1197,8 @@ describe Braintree::Subscription do
1197
1197
  ).subscription
1198
1198
 
1199
1199
  result = Braintree::Subscription.cancel(subscription.id)
1200
- result.success?.should == true
1201
- result.subscription.status.should == Braintree::Subscription::Status::Canceled
1200
+ expect(result.success?).to eq(true)
1201
+ expect(result.subscription.status).to eq(Braintree::Subscription::Status::Canceled)
1202
1202
  end
1203
1203
 
1204
1204
  it "returns a validation error if record not found" do
@@ -1215,12 +1215,12 @@ describe Braintree::Subscription do
1215
1215
  ).subscription
1216
1216
 
1217
1217
  result = Braintree::Subscription.cancel(subscription.id)
1218
- result.success?.should == true
1219
- result.subscription.status.should == Braintree::Subscription::Status::Canceled
1218
+ expect(result.success?).to eq(true)
1219
+ expect(result.subscription.status).to eq(Braintree::Subscription::Status::Canceled)
1220
1220
 
1221
1221
  result = Braintree::Subscription.cancel(subscription.id)
1222
- result.success?.should == false
1223
- result.errors.for(:subscription)[0].code.should == "81905"
1222
+ expect(result.success?).to eq(false)
1223
+ expect(result.errors.for(:subscription)[0].code).to eq("81905")
1224
1224
  end
1225
1225
  end
1226
1226
 
@@ -1233,7 +1233,7 @@ describe Braintree::Subscription do
1233
1233
  )
1234
1234
 
1235
1235
  updated_subscription = Braintree::Subscription.cancel!(subscription.id)
1236
- updated_subscription.status.should == Braintree::Subscription::Status::Canceled
1236
+ expect(updated_subscription.status).to eq(Braintree::Subscription::Status::Canceled)
1237
1237
  end
1238
1238
  end
1239
1239
 
@@ -1257,15 +1257,15 @@ describe Braintree::Subscription do
1257
1257
  search.in_trial_period.is true
1258
1258
  end
1259
1259
 
1260
- subscriptions_in_trial_period.should include(subscription_with_trial)
1261
- subscriptions_in_trial_period.should_not include(subscription_without_trial)
1260
+ expect(subscriptions_in_trial_period).to include(subscription_with_trial)
1261
+ expect(subscriptions_in_trial_period).not_to include(subscription_without_trial)
1262
1262
 
1263
1263
  subscriptions_not_in_trial_period = Braintree::Subscription.search do |search|
1264
1264
  search.in_trial_period.is false
1265
1265
  end
1266
1266
 
1267
- subscriptions_not_in_trial_period.should_not include(subscription_with_trial)
1268
- subscriptions_not_in_trial_period.should include(subscription_without_trial)
1267
+ expect(subscriptions_not_in_trial_period).not_to include(subscription_with_trial)
1268
+ expect(subscriptions_not_in_trial_period).to include(subscription_without_trial)
1269
1269
  end
1270
1270
  end
1271
1271
 
@@ -1286,21 +1286,21 @@ describe Braintree::Subscription do
1286
1286
 
1287
1287
  # not testing for specific number since the
1288
1288
  # create subscriptions accumulate over time
1289
- collection.maximum_size.should >= 1
1289
+ expect(collection.maximum_size).to be >= 1
1290
1290
 
1291
1291
  collection = Braintree::Subscription.search do |search|
1292
1292
  search.merchant_account_id.in subscription.merchant_account_id, "bogus_merchant_account_id"
1293
1293
  search.price.is "11.38"
1294
1294
  end
1295
1295
 
1296
- collection.maximum_size.should >= 1
1296
+ expect(collection.maximum_size).to be >= 1
1297
1297
 
1298
1298
  collection = Braintree::Subscription.search do |search|
1299
1299
  search.merchant_account_id.is "bogus_merchant_account_id"
1300
1300
  search.price.is "11.38"
1301
1301
  end
1302
1302
 
1303
- collection.maximum_size.should == 0
1303
+ expect(collection.maximum_size).to eq(0)
1304
1304
  end
1305
1305
  end
1306
1306
 
@@ -1323,8 +1323,8 @@ describe Braintree::Subscription do
1323
1323
  search.id.is "subscription1_#{id}"
1324
1324
  end
1325
1325
 
1326
- collection.should include(subscription1)
1327
- collection.should_not include(subscription2)
1326
+ expect(collection).to include(subscription1)
1327
+ expect(collection).not_to include(subscription2)
1328
1328
  end
1329
1329
  end
1330
1330
 
@@ -1349,16 +1349,16 @@ describe Braintree::Subscription do
1349
1349
  search.price.is "1"
1350
1350
  end
1351
1351
 
1352
- collection.should include(subscription1)
1353
- collection.should_not include(subscription2)
1352
+ expect(collection).to include(subscription1)
1353
+ expect(collection).not_to include(subscription2)
1354
1354
 
1355
1355
  collection = Braintree::Subscription.search do |search|
1356
1356
  search.merchant_account_id.in [SpecHelper::DefaultMerchantAccountId, SpecHelper::NonDefaultMerchantAccountId]
1357
1357
  search.price.is "1"
1358
1358
  end
1359
1359
 
1360
- collection.should include(subscription1)
1361
- collection.should include(subscription2)
1360
+ expect(collection).to include(subscription1)
1361
+ expect(collection).to include(subscription2)
1362
1362
  end
1363
1363
  end
1364
1364
 
@@ -1381,8 +1381,8 @@ describe Braintree::Subscription do
1381
1381
  search.price.is "2"
1382
1382
  end
1383
1383
 
1384
- collection.should include(trialless_subscription)
1385
- collection.should_not include(trial_subscription)
1384
+ expect(collection).to include(trialless_subscription)
1385
+ expect(collection).not_to include(trial_subscription)
1386
1386
  end
1387
1387
  end
1388
1388
 
@@ -1404,8 +1404,8 @@ describe Braintree::Subscription do
1404
1404
  search.price.is "5.00"
1405
1405
  end
1406
1406
 
1407
- collection.should include(subscription_500)
1408
- collection.should_not include(subscription_501)
1407
+ expect(collection).to include(subscription_500)
1408
+ expect(collection).not_to include(subscription_501)
1409
1409
  end
1410
1410
  end
1411
1411
 
@@ -1430,11 +1430,11 @@ describe Braintree::Subscription do
1430
1430
  search.days_past_due.is 5
1431
1431
  end
1432
1432
 
1433
- collection.should include(past_due_subscription)
1434
- collection.should_not include(active_subscription)
1433
+ expect(collection).to include(past_due_subscription)
1434
+ expect(collection).not_to include(active_subscription)
1435
1435
  collection.each do |s|
1436
- s.status.should == Braintree::Subscription::Status::PastDue
1437
- s.balance.should == BigDecimal("6.00")
1436
+ expect(s.status).to eq(Braintree::Subscription::Status::PastDue)
1437
+ expect(s.balance).to eq(BigDecimal("6.00"))
1438
1438
  end
1439
1439
  end
1440
1440
 
@@ -1448,10 +1448,10 @@ describe Braintree::Subscription do
1448
1448
  search.days_past_due.between 1, 20
1449
1449
  end
1450
1450
 
1451
- collection.should_not include(subscription)
1451
+ expect(collection).not_to include(subscription)
1452
1452
  collection.each do |s|
1453
- s.days_past_due.should >= 1
1454
- s.days_past_due.should <= 20
1453
+ expect(s.days_past_due).to be >= 1
1454
+ expect(s.days_past_due).to be <= 20
1455
1455
  end
1456
1456
  end
1457
1457
  end
@@ -1480,9 +1480,9 @@ describe Braintree::Subscription do
1480
1480
  search.billing_cycles_remaining.between 5, 10
1481
1481
  end
1482
1482
 
1483
- collection.should include(subscription_5)
1484
- collection.should include(subscription_9)
1485
- collection.should_not include(subscription_15)
1483
+ expect(collection).to include(subscription_5)
1484
+ expect(collection).to include(subscription_9)
1485
+ expect(collection).not_to include(subscription_15)
1486
1486
  end
1487
1487
  end
1488
1488
 
@@ -1502,8 +1502,8 @@ describe Braintree::Subscription do
1502
1502
  search.transaction_id.is matching_subscription.transactions.first.id
1503
1503
  end
1504
1504
 
1505
- collection.should include(matching_subscription)
1506
- collection.should_not include(non_matching_subscription)
1505
+ expect(collection).to include(matching_subscription)
1506
+ expect(collection).not_to include(non_matching_subscription)
1507
1507
  end
1508
1508
  end
1509
1509
 
@@ -1524,8 +1524,8 @@ describe Braintree::Subscription do
1524
1524
  search.next_billing_date >= five_days_from_now
1525
1525
  end
1526
1526
 
1527
- collection.should include(matching_subscription)
1528
- collection.should_not include(non_matching_subscription)
1527
+ expect(collection).to include(matching_subscription)
1528
+ expect(collection).not_to include(non_matching_subscription)
1529
1529
  end
1530
1530
  end
1531
1531
 
@@ -1539,7 +1539,7 @@ describe Braintree::Subscription do
1539
1539
  end
1540
1540
 
1541
1541
  it "searches on created_at in UTC using between" do
1542
- @created_at.should be_utc
1542
+ expect(@created_at).to be_utc
1543
1543
 
1544
1544
  collection = Braintree::Subscription.search do |search|
1545
1545
  search.id.is @subscription.id
@@ -1549,8 +1549,8 @@ describe Braintree::Subscription do
1549
1549
  )
1550
1550
  end
1551
1551
 
1552
- collection.maximum_size.should == 1
1553
- collection.first.id.should == @subscription.id
1552
+ expect(collection.maximum_size).to eq(1)
1553
+ expect(collection.first.id).to eq(@subscription.id)
1554
1554
  end
1555
1555
 
1556
1556
  it "searches on created_at in UTC using geq" do
@@ -1559,8 +1559,8 @@ describe Braintree::Subscription do
1559
1559
  search.created_at >= @created_at - 1
1560
1560
  end
1561
1561
 
1562
- collection.maximum_size.should == 1
1563
- collection.first.id.should == @subscription.id
1562
+ expect(collection.maximum_size).to eq(1)
1563
+ expect(collection.first.id).to eq(@subscription.id)
1564
1564
  end
1565
1565
 
1566
1566
  it "searches on created_at in UTC using leq" do
@@ -1569,8 +1569,8 @@ describe Braintree::Subscription do
1569
1569
  search.created_at <= @created_at + 1
1570
1570
  end
1571
1571
 
1572
- collection.maximum_size.should == 1
1573
- collection.first.id.should == @subscription.id
1572
+ expect(collection.maximum_size).to eq(1)
1573
+ expect(collection.first.id).to eq(@subscription.id)
1574
1574
  end
1575
1575
 
1576
1576
  it "searches on created_at in UTC and finds nothing" do
@@ -1582,7 +1582,7 @@ describe Braintree::Subscription do
1582
1582
  )
1583
1583
  end
1584
1584
 
1585
- collection.maximum_size.should == 0
1585
+ expect(collection.maximum_size).to eq(0)
1586
1586
  end
1587
1587
 
1588
1588
  it "searches on created_at in UTC using exact time" do
@@ -1591,8 +1591,8 @@ describe Braintree::Subscription do
1591
1591
  search.created_at.is @created_at
1592
1592
  end
1593
1593
 
1594
- collection.maximum_size.should == 1
1595
- collection.first.id.should == @subscription.id
1594
+ expect(collection.maximum_size).to eq(1)
1595
+ expect(collection.first.id).to eq(@subscription.id)
1596
1596
  end
1597
1597
 
1598
1598
  it "searches on created_at in local time using between" do
@@ -1606,8 +1606,8 @@ describe Braintree::Subscription do
1606
1606
  )
1607
1607
  end
1608
1608
 
1609
- collection.maximum_size.should == 1
1610
- collection.first.id.should == @subscription.id
1609
+ expect(collection.maximum_size).to eq(1)
1610
+ expect(collection.first.id).to eq(@subscription.id)
1611
1611
  end
1612
1612
 
1613
1613
  it "searches on created_at in local time using geq" do
@@ -1618,8 +1618,8 @@ describe Braintree::Subscription do
1618
1618
  search.created_at >= now - 60
1619
1619
  end
1620
1620
 
1621
- collection.maximum_size.should == 1
1622
- collection.first.id.should == @subscription.id
1621
+ expect(collection.maximum_size).to eq(1)
1622
+ expect(collection.first.id).to eq(@subscription.id)
1623
1623
  end
1624
1624
 
1625
1625
  it "searches on created_at in local time using leq" do
@@ -1630,8 +1630,8 @@ describe Braintree::Subscription do
1630
1630
  search.created_at <= now + 60
1631
1631
  end
1632
1632
 
1633
- collection.maximum_size.should == 1
1634
- collection.first.id.should == @subscription.id
1633
+ expect(collection.maximum_size).to eq(1)
1634
+ expect(collection.first.id).to eq(@subscription.id)
1635
1635
  end
1636
1636
 
1637
1637
  it "searches on created_at in local time and finds nothing" do
@@ -1645,7 +1645,7 @@ describe Braintree::Subscription do
1645
1645
  )
1646
1646
  end
1647
1647
 
1648
- collection.maximum_size.should == 0
1648
+ expect(collection.maximum_size).to eq(0)
1649
1649
  end
1650
1650
 
1651
1651
  it "searches on created_at with dates" do
@@ -1657,8 +1657,8 @@ describe Braintree::Subscription do
1657
1657
  )
1658
1658
  end
1659
1659
 
1660
- collection.maximum_size.should == 1
1661
- collection.first.id.should == @subscription.id
1660
+ expect(collection.maximum_size).to eq(1)
1661
+ expect(collection.first.id).to eq(@subscription.id)
1662
1662
  end
1663
1663
  end
1664
1664
 
@@ -1668,10 +1668,10 @@ describe Braintree::Subscription do
1668
1668
  end
1669
1669
 
1670
1670
  collection = Braintree::Subscription.search
1671
- collection.maximum_size.should > 100
1671
+ expect(collection.maximum_size).to be > 100
1672
1672
 
1673
1673
  subscriptions_ids = collection.map { |t| t.id }.uniq.compact
1674
- subscriptions_ids.size.should == collection.maximum_size
1674
+ expect(subscriptions_ids.size).to eq(collection.maximum_size)
1675
1675
  end
1676
1676
  end
1677
1677
 
@@ -1685,13 +1685,13 @@ describe Braintree::Subscription do
1685
1685
 
1686
1686
  result = Braintree::Subscription.retry_charge(subscription.id)
1687
1687
 
1688
- result.success?.should == true
1688
+ expect(result.success?).to eq(true)
1689
1689
  transaction = result.transaction
1690
1690
 
1691
- transaction.amount.should == subscription.price
1692
- transaction.processor_authorization_code.should_not be_nil
1693
- transaction.type.should == Braintree::Transaction::Type::Sale
1694
- transaction.status.should == Braintree::Transaction::Status::Authorized
1691
+ expect(transaction.amount).to eq(subscription.price)
1692
+ expect(transaction.processor_authorization_code).not_to be_nil
1693
+ expect(transaction.type).to eq(Braintree::Transaction::Type::Sale)
1694
+ expect(transaction.status).to eq(Braintree::Transaction::Status::Authorized)
1695
1695
  end
1696
1696
 
1697
1697
  it "is successful with subscription id and amount" do
@@ -1703,13 +1703,13 @@ describe Braintree::Subscription do
1703
1703
 
1704
1704
  result = Braintree::Subscription.retry_charge(subscription.id, Braintree::Test::TransactionAmounts::Authorize)
1705
1705
 
1706
- result.success?.should == true
1706
+ expect(result.success?).to eq(true)
1707
1707
  transaction = result.transaction
1708
1708
 
1709
- transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
1710
- transaction.processor_authorization_code.should_not be_nil
1711
- transaction.type.should == Braintree::Transaction::Type::Sale
1712
- transaction.status.should == Braintree::Transaction::Status::Authorized
1709
+ expect(transaction.amount).to eq(BigDecimal(Braintree::Test::TransactionAmounts::Authorize))
1710
+ expect(transaction.processor_authorization_code).not_to be_nil
1711
+ expect(transaction.type).to eq(Braintree::Transaction::Type::Sale)
1712
+ expect(transaction.status).to eq(Braintree::Transaction::Status::Authorized)
1713
1713
  end
1714
1714
 
1715
1715
  it "is successful with subscription id and submit_for_settlement" do
@@ -1721,13 +1721,13 @@ describe Braintree::Subscription do
1721
1721
 
1722
1722
  result = Braintree::Subscription.retry_charge(subscription.id, Braintree::Test::TransactionAmounts::Authorize, true)
1723
1723
 
1724
- result.success?.should == true
1724
+ expect(result.success?).to eq(true)
1725
1725
  transaction = result.transaction
1726
1726
 
1727
- transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
1728
- transaction.processor_authorization_code.should_not be_nil
1729
- transaction.type.should == Braintree::Transaction::Type::Sale
1730
- transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
1727
+ expect(transaction.amount).to eq(BigDecimal(Braintree::Test::TransactionAmounts::Authorize))
1728
+ expect(transaction.processor_authorization_code).not_to be_nil
1729
+ expect(transaction.type).to eq(Braintree::Transaction::Type::Sale)
1730
+ expect(transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
1731
1731
  end
1732
1732
 
1733
1733
  it "is successful with subscription id, amount and submit_for_settlement" do
@@ -1739,13 +1739,13 @@ describe Braintree::Subscription do
1739
1739
 
1740
1740
  result = Braintree::Subscription.retry_charge(subscription.id, Braintree::Test::TransactionAmounts::Authorize, true)
1741
1741
 
1742
- result.success?.should == true
1742
+ expect(result.success?).to eq(true)
1743
1743
  transaction = result.transaction
1744
1744
 
1745
- transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
1746
- transaction.processor_authorization_code.should_not be_nil
1747
- transaction.type.should == Braintree::Transaction::Type::Sale
1748
- transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
1745
+ expect(transaction.amount).to eq(BigDecimal(Braintree::Test::TransactionAmounts::Authorize))
1746
+ expect(transaction.processor_authorization_code).not_to be_nil
1747
+ expect(transaction.type).to eq(Braintree::Transaction::Type::Sale)
1748
+ expect(transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
1749
1749
  end
1750
1750
  end
1751
1751
  end