Sha256: 0524358ebffaea5fcd2940cb5a84ca21f1e0bd830626c7f0764396cf40aec12a
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true describe Hydra::RoleManagement::UserRoles do let(:librarian) { Role.create!(name: 'librarian') } describe 'a real user' do subject(:user) do User.create!(email: 'fred@example.com', password: 'password') end it 'has admin?' do expect(user).not_to be_admin end describe 'with roles' do before do user.roles << librarian end its(:roles) { is_expected.to eq [librarian] } its(:groups) { is_expected.to include('registered', 'librarian') } end end describe 'when DeviseGuests is installed' do before do stub_const('DeviseGuests', true) end describe 'a real user' do subject(:user) do User.create!(email: 'fred@example.com', password: 'password') end it { is_expected.not_to be_admin } describe 'with roles' do before do user.roles << librarian end its(:groups) { is_expected.to include('registered', 'librarian') } end end describe 'a guest user' do subject(:user) do User.create!(email: 'fred@example.com', password: 'password', guest: true) end it { is_expected.not_to be_admin } its(:groups) { is_expected.to be_empty } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hydra-role-management-1.2.0 | spec/lib/user_roles_spec.rb |
hydra-role-management-1.1.0 | spec/lib/user_roles_spec.rb |
hydra-role-management-1.0.3 | spec/lib/user_roles_spec.rb |