Limiting shops loaded onto standing orders index to those with standing orders enabled

This commit is contained in:
Rob Harrington
2016-12-15 16:03:46 +11:00
parent 25639a822a
commit a6add2eff6
2 changed files with 3 additions and 2 deletions

View File

@@ -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

View File

@@ -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