8e3f37bc508aba0ca3408003cc59c6bec0d5ffcaEugen Kuksarequire 'spec_helper'
8e3f37bc508aba0ca3408003cc59c6bec0d5ffcaEugen Kuksa let(:permission) { create(:permission, subject: owner, role: 'owner') }
8e3f37bc508aba0ca3408003cc59c6bec0d5ffcaEugen Kuksa expect{ permission.destroy }.to raise_error(Permission::PowerVaccuumError)
8e3f37bc508aba0ca3408003cc59c6bec0d5ffcaEugen Kuksa it 'should not be possible to degrade his role' do
1e3b00b030ba156e5002b1013b28be89adea13d5Eugen Kuksa it "should be possible to remove a #{role} permission" do
8e3f37bc508aba0ca3408003cc59c6bec0d5ffcaEugen Kuksa other_permission = create(:permission, subject: owner, role: role)
8e3f37bc508aba0ca3408003cc59c6bec0d5ffcaEugen Kuksa expect{ other_permission.destroy }.not_to raise_error
8e3f37bc508aba0ca3408003cc59c6bec0d5ffcaEugen Kuksa create(:permission, subject: other_owner, role: 'owner', item: permission.item)
0549ef82aa9c58cf3d5bf707040482b3aa5695b2Eugen Kuksa expect(repository.permission?(perm, admin)).to be(true)
7c7a19761235efff584ee65a1c6dc4aa1735ff64Eugen Kuksa let(:permission) { create :permission, item: repository }
0549ef82aa9c58cf3d5bf707040482b3aa5695b2Eugen Kuksa expect(repository.permission?(perm, permission.subject)).to be(true)
0549ef82aa9c58cf3d5bf707040482b3aa5695b2Eugen Kuksa expect(repository.permission?(:owner, permission.subject)).to be(false)
0549ef82aa9c58cf3d5bf707040482b3aa5695b2Eugen Kuksa expect(repository.permission?(:editor, permission.subject)).to be(true)
0549ef82aa9c58cf3d5bf707040482b3aa5695b2Eugen Kuksa expect(repository.permission?(perm, team_user.user)).to be(true)
0549ef82aa9c58cf3d5bf707040482b3aa5695b2Eugen Kuksa expect(repository.permission?(perm, nil)).to be(false)
7c7a19761235efff584ee65a1c6dc4aa1735ff64Eugen Kuksa let(:permission) { create :permission, item: repository }
0549ef82aa9c58cf3d5bf707040482b3aa5695b2Eugen Kuksa expect(repository.permission?(perm, team_user.user)).to be(false)