ssh_access_spec.rb revision 0dcf2700340141bc08344977e966e7ec095a8e8e
98N/Arequire 'spec_helper'
98N/A
1356N/Adescribe SshAccess do
1356N/A
98N/A let(:permission) { create :permission }
1608N/A let(:user) { permission.subject }
98N/A let(:repository) { permission.item }
98N/A
919N/A context 'without a permission' do
919N/A
919N/A it 'should allow read on public readable repository' do
919N/A repository.access = 'public_r'
919N/A access = described_class.determine_permission('read', nil, repository)
919N/A expect(access).to be_true
919N/A end
919N/A
919N/A it 'should disallow write on public readable repository' do
919N/A repository.access = 'public_r'
919N/A access = described_class.determine_permission('write', nil, repository)
919N/A expect(access).to be_false
919N/A end
919N/A
919N/A it 'should allow read on public read-writeable repository' do
919N/A repository.access = 'public_rw'
919N/A access = described_class.determine_permission('read', nil, repository)
98N/A expect(access).to be_true
98N/A end
98N/A
98N/A it 'should allow write on public read-writeable repository' do
493N/A repository.access = 'public_rw'
98N/A access = described_class.determine_permission('write', nil, repository)
98N/A expect(access).to be_true
1634N/A end
98N/A
911N/A it 'should disallow read on private readable repository' do
1634N/A repository.access = 'private_r'
1634N/A access = described_class.determine_permission('read', nil, repository)
1634N/A expect(access).to be_false
911N/A end
98N/A
1359N/A it 'should disallow write on private readable repository' do
1674N/A repository.access = 'private_r'
1362N/A access = described_class.determine_permission('write', nil, repository)
1522N/A expect(access).to be_false
1580N/A end
1608N/A
691N/A it 'should disallow read on private read-writeable repository' do
691N/A repository.access = 'private_rw'
691N/A access = described_class.determine_permission('read', nil, repository)
691N/A expect(access).to be_false
691N/A end
691N/A
98N/A it 'should disallow write on private read-writeable repository' do
1356N/A repository.access = 'private_rw'
1356N/A access = described_class.determine_permission('write', nil, repository)
1356N/A expect(access).to be_false
1356N/A end
98N/A
98N/A end
493N/A
98N/A context 'with permission' do
98N/A
965N/A it 'should allow read on public readable repository' do
965N/A repository.access = 'public_r'
1508N/A access = described_class.determine_permission('read', permission, repository)
493N/A expect(access).to be_true
1097N/A end
1097N/A
965N/A it 'should disallow write on public readable repository' do
98N/A repository.access = 'public_r'
98N/A access = described_class.determine_permission('write', permission, repository)
expect(access).to be_false
end
it 'should allow read on public read-writeable repository' do
repository.access = 'public_rw'
access = described_class.determine_permission('read', permission, repository)
expect(access).to be_true
end
it 'should allow write on public read-writeable repository' do
repository.access = 'public_rw'
access = described_class.determine_permission('write', permission, repository)
expect(access).to be_true
end
it 'should allow read on private readable repository' do
repository.access = 'private_r'
access = described_class.determine_permission('read', permission, repository)
expect(access).to be_true
end
it 'should disallow write on private readable repository' do
repository.access = 'private_r'
access = described_class.determine_permission('write', permission, repository)
expect(access).to be_false
end
it 'should allow read on private read-writeable repository' do
repository.access = 'private_rw'
access = described_class.determine_permission('read', permission, repository)
expect(access).to be_true
end
it 'should allow write on private read-writeable repository' do
repository.access = 'private_rw'
access = described_class.determine_permission('write', permission, repository)
expect(access).to be_true
end
end
end