diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/solidus_subscriptions/processor.rb | 1 | ||||
-rw-r--r-- | lib/solidus_subscriptions/testing_support/factories/subscription_factory.rb | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/solidus_subscriptions/processor.rb b/lib/solidus_subscriptions/processor.rb index f95e16f..4c4894e 100644 --- a/lib/solidus_subscriptions/processor.rb +++ b/lib/solidus_subscriptions/processor.rb @@ -83,6 +83,7 @@ module SolidusSubscriptions subscriptions_by_id.fetch(user.id, []).map do |sub| ActiveRecord::Base.transaction do sub.advance_actionable_date + sub.cancel! if sub.pending_cancellation? sub.installments.create! end end diff --git a/lib/solidus_subscriptions/testing_support/factories/subscription_factory.rb b/lib/solidus_subscriptions/testing_support/factories/subscription_factory.rb index 92ecb77..e4f3cdc 100644 --- a/lib/solidus_subscriptions/testing_support/factories/subscription_factory.rb +++ b/lib/solidus_subscriptions/testing_support/factories/subscription_factory.rb @@ -23,6 +23,11 @@ FactoryGirl.define do actionable_date { Time.zone.now.tomorrow } end + trait(:pending_cancellation) do + actionable + state { 'pending_cancellation' } + end + trait(:canceled) { state 'canceled' } trait(:inactive) { state 'inactive' } end |