add tests to assign and unassign organization admin role
This commit is contained in:
parent
68e8cf48ae
commit
b800878f90
4 changed files with 89 additions and 2 deletions
|
|
@ -62,7 +62,7 @@ describe 'User with admin role' do
|
|||
|
||||
it{ should_not be_able_to(:update, Role.find_by(name: 'organization_admin', resource: other_organization)) }
|
||||
it{ should_not be_able_to(:edit, Role.find_by(name: 'organization_admin', resource: other_organization)) }
|
||||
it{ should_not be_able_to(:show, Role.find_by(name: 'organization_admin', resource: other_organization)) }
|
||||
it{ should be_able_to(:admins, organization) }
|
||||
|
||||
it{ should_not be_able_to(:new, User.new) }
|
||||
it{ should_not be_able_to(:create, User.new) }
|
||||
|
|
@ -126,6 +126,8 @@ describe 'User with admin role' do
|
|||
let(:other_organization) { create(:organization) }
|
||||
let(:other_conference) { create(:conference, organization: other_organization) }
|
||||
|
||||
it{ should be_able_to(:assign_org_admins, organization) }
|
||||
it{ should be_able_to(:unassign_org_admins, organization) }
|
||||
it{ should be_able_to(:manage, my_conference) }
|
||||
it{ should be_able_to(:read, organization) }
|
||||
it{ should be_able_to(:update, organization) }
|
||||
|
|
@ -136,6 +138,8 @@ describe 'User with admin role' do
|
|||
it{ should_not be_able_to(:create, Conference.new(organization_id: other_organization.id)) }
|
||||
it{ should_not be_able_to(:new, Organization.new) }
|
||||
it{ should_not be_able_to(:create, Organization.new) }
|
||||
|
||||
it_behaves_like 'user with any role'
|
||||
end
|
||||
|
||||
context 'when user has the role organizer' do
|
||||
|
|
@ -213,6 +217,9 @@ describe 'User with admin role' do
|
|||
|
||||
it{ should be_able_to(:manage, resource) }
|
||||
|
||||
it{ should_not be_able_to(:assign_org_admins, organization) }
|
||||
it{ should_not be_able_to(:unassign_org_admins, organization) }
|
||||
|
||||
%w[organizer cfp info_desk volunteers_coordinator].each do |role|
|
||||
it{ should be_able_to(:toggle_user, Role.find_by(name: role, resource: my_conference)) }
|
||||
it{ should be_able_to(:edit, Role.find_by(name: role, resource: my_conference)) }
|
||||
|
|
@ -298,6 +305,8 @@ describe 'User with admin role' do
|
|||
it{ should be_able_to(:index, resource) }
|
||||
it{ should be_able_to(:show, resource) }
|
||||
it{ should be_able_to(:update, resource) }
|
||||
it{ should_not be_able_to(:assign_org_admins, organization) }
|
||||
it{ should_not be_able_to(:unassign_org_admins, organization) }
|
||||
|
||||
it_behaves_like 'user with any role'
|
||||
it_behaves_like 'user with non-organizer role', 'cfp'
|
||||
|
|
@ -365,6 +374,8 @@ describe 'User with admin role' do
|
|||
it{ should be_able_to(:index, resource) }
|
||||
it{ should be_able_to(:show, resource) }
|
||||
it{ should be_able_to(:update, resource) }
|
||||
it{ should_not be_able_to(:assign_org_admins, organization) }
|
||||
it{ should_not be_able_to(:unassign_org_admins, organization) }
|
||||
|
||||
it_behaves_like 'user with any role'
|
||||
it_behaves_like 'user with non-organizer role', 'info_desk'
|
||||
|
|
@ -432,6 +443,8 @@ describe 'User with admin role' do
|
|||
it{ should be_able_to(:index, resource) }
|
||||
it{ should be_able_to(:show, resource) }
|
||||
it{ should be_able_to(:update, resource) }
|
||||
it{ should_not be_able_to(:assign_org_admins, organization) }
|
||||
it{ should_not be_able_to(:unassign_org_admins, organization) }
|
||||
|
||||
it 'should be_able to :manage Vposition'
|
||||
it 'should be_able to :manage Vday'
|
||||
|
|
@ -508,6 +521,9 @@ describe 'User with admin role' do
|
|||
it{ should_not be_able_to(:edit, my_self_organized_track) }
|
||||
it{ should_not be_able_to(:update, my_self_organized_track) }
|
||||
|
||||
it{ should_not be_able_to(:assign_org_admins, organization) }
|
||||
it{ should_not be_able_to(:unassign_org_admins, organization) }
|
||||
|
||||
it_behaves_like 'user with any role'
|
||||
it_behaves_like 'user with non-organizer role', 'track_organizer'
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue