spec/integration/braintree/subscription_spec.rb in braintree-2.38.0 vs spec/integration/braintree/subscription_spec.rb in braintree-2.39.0
- old
+ new
@@ -36,10 +36,14 @@
result.subscription.failure_count.should == 0
result.subscription.next_bill_amount.should == "12.34"
result.subscription.next_billing_period_amount.should == "12.34"
result.subscription.payment_method_token.should == @credit_card.token
+
+ result.subscription.status_history.first.price.should == "12.34"
+ result.subscription.status_history.first.status.should == Braintree::Subscription::Status::Active
+ result.subscription.status_history.first.subscription_source.should == Braintree::Subscription::Source::Api
end
it "returns a transaction with billing period populated" do
result = Braintree::Subscription.create(
:payment_method_token => @credit_card.token,
@@ -303,11 +307,11 @@
:payment_method_token => @credit_card.token,
:plan_id => SpecHelper::TriallessPlan[:id],
:price => Braintree::Test::TransactionAmounts::Decline
)
- result.success?.should be_false
+ result.success?.should be(false)
result.transaction.status.should == Braintree::Transaction::Status::ProcessorDeclined
result.message.should == "Do Not Honor"
end
end
@@ -415,35 +419,35 @@
add_ons.first.id.should == "increase_10"
add_ons.first.amount.should == BigDecimal.new("10.00")
add_ons.first.quantity.should == 1
add_ons.first.number_of_billing_cycles.should be_nil
- add_ons.first.never_expires?.should be_true
+ add_ons.first.never_expires?.should be(true)
add_ons.first.current_billing_cycle.should == 0
add_ons.last.id.should == "increase_20"
add_ons.last.amount.should == BigDecimal.new("20.00")
add_ons.last.quantity.should == 1
add_ons.last.number_of_billing_cycles.should be_nil
- add_ons.last.never_expires?.should be_true
+ add_ons.last.never_expires?.should be(true)
add_ons.last.current_billing_cycle.should == 0
subscription.discounts.size.should == 2
discounts = subscription.discounts.sort_by { |discount| discount.id }
discounts.first.id.should == "discount_11"
discounts.first.amount.should == BigDecimal.new("11.00")
discounts.first.quantity.should == 1
discounts.first.number_of_billing_cycles.should be_nil
- discounts.first.never_expires?.should be_true
+ discounts.first.never_expires?.should be(true)
discounts.first.current_billing_cycle.should == 0
discounts.last.id.should == "discount_7"
discounts.last.amount.should == BigDecimal.new("7.00")
discounts.last.quantity.should == 1
discounts.last.number_of_billing_cycles.should be_nil
- discounts.last.never_expires?.should be_true
+ discounts.last.never_expires?.should be(true)
discounts.last.current_billing_cycle.should == 0
end
it "allows overriding of inherited add_ons and discounts" do
result = Braintree::Subscription.create(
@@ -479,11 +483,11 @@
add_ons.first.id.should == "increase_10"
add_ons.first.amount.should == BigDecimal.new("50.00")
add_ons.first.quantity.should == 2
add_ons.first.number_of_billing_cycles.should == 5
- add_ons.first.never_expires?.should be_false
+ add_ons.first.never_expires?.should be(false)
add_ons.first.current_billing_cycle.should == 0
add_ons.last.id.should == "increase_20"
add_ons.last.amount.should == BigDecimal.new("20.00")
add_ons.last.quantity.should == 1
@@ -499,11 +503,11 @@
discounts.last.id.should == "discount_7"
discounts.last.amount.should == BigDecimal.new("15.00")
discounts.last.quantity.should == 3
discounts.last.number_of_billing_cycles.should be_nil
- discounts.last.never_expires?.should be_true
+ discounts.last.never_expires?.should be(true)
discounts.last.current_billing_cycle.should == 0
end
it "allows deleting of inherited add_ons and discounts" do
result = Braintree::Subscription.create(
@@ -945,10 +949,10 @@
:never_expires => true
)
result.success?.should == true
result.subscription.number_of_billing_cycles.should == nil
- result.subscription.never_expires?.should be_true
+ result.subscription.never_expires?.should be(true)
end
end
context "add_ons and discounts" do
it "can update add_ons and discounts" do