mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Note this task is still rather naive and only covers the simple case where an enterprise was created but never used and thus, does not have any associated entities like orders. This is enough for the case I have at hand where a hub's manager created an enterprise while he wanted to create a user account #ux. He ended up with an enterprise named after him and now he asked us to clean that up.
20 lines
505 B
Ruby
20 lines
505 B
Ruby
require 'spec_helper'
|
|
require 'rake'
|
|
|
|
describe 'enterprises.rake' do
|
|
describe ':remove_enterprise' do
|
|
context 'when the enterprises exists' do
|
|
it 'removes the enterprise' do
|
|
enterprise = create(:enterprise)
|
|
|
|
Rake.application.rake_require 'tasks/enterprises'
|
|
Rake::Task.define_task(:environment)
|
|
|
|
expect {
|
|
Rake.application.invoke_task "ofn:remove_enterprise[#{enterprise.id}]"
|
|
}.to change(Enterprise, :count).by(-1)
|
|
end
|
|
end
|
|
end
|
|
end
|