Files
openfoodnetwork/spec/controllers/api/enterprise_fees_controller_spec.rb
2020-06-22 13:03:18 +01:00

25 lines
696 B
Ruby

require 'spec_helper'
module Api
describe EnterpriseFeesController, type: :controller do
include AuthenticationWorkflow
let!(:unreferenced_fee) { create(:enterprise_fee) }
let!(:referenced_fee) { create(:enterprise_fee) }
let(:product) { create(:product) }
let(:distributor) { create(:distributor_enterprise) }
let(:current_user) { create(:admin_user) }
before do
allow(controller).to receive(:spree_current_user) { current_user }
end
describe "destroy" do
it "removes the fee" do
expect { spree_delete :destroy, id: unreferenced_fee.id, format: :json }
.to change { EnterpriseFee.count }.by(-1)
end
end
end
end