Add a spec for making sure super_admin? returns false if the user has no roles
This commit is contained in:
parent
9264297a51
commit
022ac4e80b
1 changed files with 9 additions and 0 deletions
|
@ -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
|
Loading…
Reference in a new issue