spec/integration/braintree/subscription_spec.rb in braintree-4.18.0 vs spec/integration/braintree/subscription_spec.rb in braintree-4.19.0
- old
+ new
@@ -134,11 +134,10 @@
expect(transaction.paypal_details.payer_email).to eq("payer@example.com")
expect(transaction.paypal_details.description).to eq("A great product")
end
it "returns an error if the payment_method_nonce hasn't been vaulted" do
- customer = Braintree::Customer.create!
result = Braintree::Subscription.create(
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
:plan_id => SpecHelper::TriallessPlan[:id],
)
@@ -935,21 +934,21 @@
expect(result.errors.for(:subscription).on(:price)[0].code).to eq(Braintree::ErrorCodes::Subscription::PriceFormatIsInvalid)
end
it "has validation errors on duplicate id" do
duplicate_id = "new_id_#{rand(36**6).to_s(36)}"
- duplicate = Braintree::Subscription.create(
+ Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TrialPlan[:id],
:id => duplicate_id,
)
- result = Braintree::Subscription.update(
+ duplicate = Braintree::Subscription.update(
@subscription.id,
:id => duplicate_id,
)
- expect(result.success?).to eq(false)
- expect(result.errors.for(:subscription).on(:id)[0].code).to eq(Braintree::ErrorCodes::Subscription::IdIsInUse)
+ expect(duplicate.success?).to eq(false)
+ expect(duplicate.errors.for(:subscription).on(:id)[0].code).to eq(Braintree::ErrorCodes::Subscription::IdIsInUse)
end
it "cannot update a canceled subscription" do
subscription = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
@@ -1201,10 +1200,10 @@
expect(result.subscription.status).to eq(Braintree::Subscription::Status::Canceled)
end
it "returns a validation error if record not found" do
expect {
- r = Braintree::Subscription.cancel("noSuchSubscription")
+ Braintree::Subscription.cancel("noSuchSubscription")
}.to raise_error(Braintree::NotFoundError, 'subscription with id "noSuchSubscription" not found')
end
it "cannot be canceled if already canceled" do
subscription = Braintree::Subscription.create(