mending permissions and test

This commit is contained in:
shlok007 2017-06-13 20:57:55 +05:30
parent b72e64b238
commit aa3df0243e
2 changed files with 19 additions and 13 deletions

View file

@ -141,7 +141,7 @@ describe 'User' do
shared_examples 'user with any role' do
before do
@other_organization = create(:organization)
@other_conference = create(:conference)
@other_conference = create(:conference, organization: @other_organization)
end
it{ should_not be_able_to(:update, Role.find_by(name: 'organization_admin', resource: @other_organization)) }
@ -179,8 +179,6 @@ describe 'User' do
it{ should_not be_able_to(:manage, other_conference) }
it{ should be_able_to(:manage, my_conference) }
it{ should be_able_to(:manage, organization) }
it_behaves_like 'user with any role'
end
context 'when user has the role organizer' do
@ -199,8 +197,10 @@ describe 'User' do
should be_able_to(:destroy, my_venue)
end
it{ should be_able_to(:new, Conference) }
it{ should be_able_to(:create, Conference) }
it{ should_not be_able_to(:new, Organization)}
it{ should_not be_able_to(:create, Organization)}
it{ should_not be_able_to(:new, Conference.new) }
it{ should_not be_able_to(:create, Conference.new) }
it{ should be_able_to(:manage, my_conference) }
it{ should_not be_able_to(:manage, conference_public) }
it{ should be_able_to(:manage, my_conference.splashpage) }