mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Limiting shops loaded onto standing orders index to those with standing orders enabled
This commit is contained in:
@@ -77,7 +77,7 @@ module Admin
|
||||
end
|
||||
|
||||
def load_shops
|
||||
@shops = Enterprise.managed_by(spree_current_user).is_distributor
|
||||
@shops = Enterprise.managed_by(spree_current_user).is_distributor.where(enable_standing_orders: true)
|
||||
end
|
||||
|
||||
def load_form_data
|
||||
|
||||
@@ -5,7 +5,7 @@ describe Admin::StandingOrdersController, type: :controller do
|
||||
|
||||
describe 'index' do
|
||||
let!(:user) { create(:user, enterprise_limit: 10) }
|
||||
let!(:shop) { create(:distributor_enterprise) }
|
||||
let!(:shop) { create(:distributor_enterprise, enable_standing_orders: true) }
|
||||
let!(:standing_order) { create(:standing_order, shop: shop) }
|
||||
|
||||
before do
|
||||
@@ -24,6 +24,7 @@ describe Admin::StandingOrdersController, type: :controller do
|
||||
|
||||
context 'as an enterprise user' do
|
||||
before { shop.update_attributes(owner: user) }
|
||||
let!(:not_enabled_shop) { create(:distributor_enterprise, owner: user) }
|
||||
|
||||
it 'renders the index page with appropriate data' do
|
||||
spree_get :index, params
|
||||
|
||||
Reference in New Issue
Block a user