Merge pull request #2733 from kristinalim/fix-subscription_should_not_require_future_oc

Reduce restrictions for adding a variant to a subscription
This commit is contained in:
Pau Pérez Fabregat
2019-02-06 21:24:57 +01:00
committed by GitHub
20 changed files with 528 additions and 159 deletions

View File

@@ -10,9 +10,9 @@ describe Admin::SubscriptionLineItemsController, type: :controller do
let(:unmanaged_shop) { create(:enterprise) }
let!(:product) { create(:product) }
let!(:variant) { create(:variant, product: product, unit_value: '100', price: 15.00, option_values: []) }
let!(:outgoing_exchange) { order_cycle.exchanges.create(sender: shop, receiver: shop, variants: [variant], enterprise_fees: [enterprise_fee]) }
let!(:enterprise_fee) { create(:enterprise_fee, amount: 3.50) }
let!(:order_cycle) { create(:simple_order_cycle, coordinator: shop, orders_open_at: 2.days.from_now, orders_close_at: 7.days.from_now) }
let!(:outgoing_exchange) { order_cycle.exchanges.create(sender: shop, receiver: shop, variants: [variant], enterprise_fees: [enterprise_fee]) }
let!(:schedule) { create(:schedule, order_cycles: [order_cycle]) }
let(:unmanaged_schedule) { create(:schedule, order_cycles: [create(:simple_order_cycle, coordinator: unmanaged_shop)]) }
@@ -42,6 +42,8 @@ describe Admin::SubscriptionLineItemsController, type: :controller do
before { params.merge!(shop_id: shop.id) }
context "but the shop doesn't have permission to sell product in question" do
let!(:outgoing_exchange) { }
it "returns an error" do
spree_post :build, params
json_response = JSON.parse(response.body)

View File

@@ -341,7 +341,7 @@ describe Admin::SubscriptionsController, type: :controller do
end
context 'with subscription_line_items params' do
let!(:product2) { create(:product, supplier: shop) }
let!(:product2) { create(:product) }
let!(:variant2) { create(:variant, product: product2, unit_value: '1000', price: 6.00, option_values: []) }
before do