mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-06 22:36:07 +00:00
Check destroying order_cycle will delete associated coordinator fees
This commit is contained in:
@@ -401,6 +401,20 @@ module Admin
|
||||
expect(flash[:error]).to eq I18n.t('admin.order_cycles.destroy_errors.schedule_present')
|
||||
end
|
||||
end
|
||||
|
||||
describe "when an order cycle has any coordinator_fees", :debug do
|
||||
let(:enterprise_fee1) { create(:enterprise_fee) }
|
||||
|
||||
before do
|
||||
oc.coordinator_fees << enterprise_fee1
|
||||
end
|
||||
|
||||
it "displays an error message when we attempt to delete it" do
|
||||
get :destroy, params: { id: oc.id }
|
||||
expect(OrderCycle.find_by(id: oc.id)).to be nil
|
||||
expect(response).to redirect_to admin_order_cycles_path
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user