mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-27 21:06:49 +00:00
The new product image import spec was loading rake tasks multiple times. That make the spec for enterprise deletion fail when executed afterwards because the deletion task was executed twice and failed the second time.
24 lines
554 B
Ruby
24 lines
554 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
require 'rake'
|
|
|
|
describe 'enterprises.rake' do
|
|
before(:all) do
|
|
Rake.application.rake_require("tasks/enterprises")
|
|
Rake::Task.define_task(:environment)
|
|
end
|
|
|
|
describe ':remove_enterprise' do
|
|
context 'when the enterprises exists' do
|
|
it 'removes the enterprise' do
|
|
enterprise = create(:enterprise)
|
|
|
|
expect {
|
|
Rake.application.invoke_task "ofn:remove_enterprise[#{enterprise.id}]"
|
|
}.to change { Enterprise.count }.by(-1)
|
|
end
|
|
end
|
|
end
|
|
end
|