Add a spec for making sure super_admin? returns false if the user has no roles

This commit is contained in:
Eric Schultz 2021-02-19 15:05:47 -06:00 committed by Eric Schultz
parent 9264297a51
commit 022ac4e80b

View file

@ -19,6 +19,11 @@ RSpec.describe User, type: :model do
sa.roles.create(name: 'nonprofit_associate') sa.roles.create(name: 'nonprofit_associate')
sa sa
} }
let(:no_roles) {
sa = create(:user)
sa
}
it 'returns true for super admin' do it 'returns true for super admin' do
expect(super_admin).to be_super_admin expect(super_admin).to be_super_admin
@ -27,5 +32,9 @@ RSpec.describe User, type: :model do
it 'returns false for not super admin' do it 'returns false for not super admin' do
expect(not_super_admin).to_not be_super_admin expect(not_super_admin).to_not be_super_admin
end end
it 'returns false when has no roles' do
expect(no_roles).to_not be_super_admin
end
end end
end end