Add unit tests for admin entreprises changes

This commit is contained in:
François Turbelin
2024-11-26 00:15:45 +01:00
committed by Rachel Arnould
parent 57c237c72d
commit e37881837b
2 changed files with 18 additions and 0 deletions

View File

@@ -409,6 +409,16 @@ RSpec.describe Admin::EnterprisesController, type: :controller do
distributor.reload
expect(distributor.users).to include user
end
it "allows 'external_billing_id' to be changed" do
allow(controller).to receive_messages spree_current_user: admin_user
enterprise_params =
{ id: profile_enterprise, enterprise: { external_billing_id: 'INV123456' } }
spree_put :update, enterprise_params
profile_enterprise.reload
expect(profile_enterprise.external_billing_id).to eq 'INV123456'
end
end
context "geocoding" do

View File

@@ -33,5 +33,13 @@ RSpec.describe Admin::EnterprisesHelper, type: :helper do
user.enterprises << enterprise
expect(visible_items.pluck(:name)).to include "connected_apps"
end
context 'when user is an admin' do
let(:user) { create(:admin_user) }
it "includes admin-only item" do
expect(visible_items.pluck(:name)).to include "admin_only"
end
end
end
end