mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-03 06:59:14 +00:00
Add unit tests for admin entreprises changes
This commit is contained in:
committed by
Rachel Arnould
parent
57c237c72d
commit
e37881837b
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user