summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Deere <brendan.g.deere@gmail.com>2016-12-21 13:06:47 -0800
committerBrendan Deere <brendan@stembolt.com>2017-01-06 14:35:58 -0800
commit7231cc769d0dd993d5ee3f6729517251b36ccb11 (patch)
tree8a00b0ddb337385b9ad7ae2c497cb250521ec31b
parentd28bb0da1249e784907e75e5997de2e1a506b420 (diff)
Use subscription store for installment orders
Subscriptions now track which store they belong to. This is the store that should be used when creating new subscription orders. As before if for some reason there is no associated store, fallback and use the default store
-rw-r--r--app/models/solidus_subscriptions/consolidated_installment.rb2
-rw-r--r--spec/models/solidus_subscriptions/consolidated_installment_spec.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/solidus_subscriptions/consolidated_installment.rb b/app/models/solidus_subscriptions/consolidated_installment.rb
index 784f1ac..210f09d 100644
--- a/app/models/solidus_subscriptions/consolidated_installment.rb
+++ b/app/models/solidus_subscriptions/consolidated_installment.rb
@@ -57,7 +57,7 @@ module SolidusSubscriptions
@order ||= Spree::Order.create(
user: user,
email: user.email,
- store: root_order.try!(:store) || Spree::Store.default,
+ store: subscription.store || Spree::Store.default,
subscription_order: true
)
end
diff --git a/spec/models/solidus_subscriptions/consolidated_installment_spec.rb b/spec/models/solidus_subscriptions/consolidated_installment_spec.rb
index 3a6411e..062ef6f 100644
--- a/spec/models/solidus_subscriptions/consolidated_installment_spec.rb
+++ b/spec/models/solidus_subscriptions/consolidated_installment_spec.rb
@@ -266,7 +266,7 @@ RSpec.describe SolidusSubscriptions::ConsolidatedInstallment do
expect(subject).to have_attributes(
user: user,
email: user.email,
- store: root_order.store
+ store: installments.first.subscription.store
)
end