Files
openfoodnetwork/spec/lib/tasks/enterprises_rake_spec.rb
2024-05-09 12:24:41 +10:00

24 lines
560 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
require 'rake'
RSpec.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