ssh_access_spec.rb revision f198c0ec200763fe1b0db998cd9418f412be8361
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehaserequire 'spec_helper'
d60ddfb99765ab4fe956503f3f83d9c8f493eb99Tim Reddehase let(:permission) { create :permission, role: 'reader' }
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should allow read on public readable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('read', nil, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should disallow write on public readable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('write', nil, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should allow read on public read-writeable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('read', nil, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should allow write on public read-writeable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('write', nil, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should disallow read on private readable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('read', nil, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should disallow write on private readable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('write', nil, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should disallow read on private read-writeable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('read', nil, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should disallow write on private read-writeable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('write', nil, repository)
9c3a9ea5002b6efbb3e3640fe215e63b8dfb619dTim Reddehase it 'should raise error on write to mirror repository' do
9c3a9ea5002b6efbb3e3640fe215e63b8dfb619dTim Reddehase repository.source_address = 'http://some_source_address.example.com'
9c3a9ea5002b6efbb3e3640fe215e63b8dfb619dTim Reddehase expect { described_class.determine_permission('write', nil, repository) }.
d60ddfb99765ab4fe956503f3f83d9c8f493eb99Tim Reddehase let(:permission) { create :permission, role: 'owner' }
d60ddfb99765ab4fe956503f3f83d9c8f493eb99Tim Reddehase it 'should allow write on public readable repository' do
d60ddfb99765ab4fe956503f3f83d9c8f493eb99Tim Reddehase access = described_class.determine_permission('write', permission, repository)
d60ddfb99765ab4fe956503f3f83d9c8f493eb99Tim Reddehase it 'should allow write on private readable repository' do
d60ddfb99765ab4fe956503f3f83d9c8f493eb99Tim Reddehase access = described_class.determine_permission('write', permission, repository)
9c3a9ea5002b6efbb3e3640fe215e63b8dfb619dTim Reddehase it 'should raise error on write to mirror repository' do
9c3a9ea5002b6efbb3e3640fe215e63b8dfb619dTim Reddehase repository.source_address = 'http://some_source_address.example.com'
9c3a9ea5002b6efbb3e3640fe215e63b8dfb619dTim Reddehase expect { described_class.determine_permission('write', permission, repository) }.
d60ddfb99765ab4fe956503f3f83d9c8f493eb99Tim Reddehase let(:permission) { create :permission, role: 'editor' }
d60ddfb99765ab4fe956503f3f83d9c8f493eb99Tim Reddehase it 'should allow write on public readable repository' do
d60ddfb99765ab4fe956503f3f83d9c8f493eb99Tim Reddehase access = described_class.determine_permission('write', permission, repository)
d60ddfb99765ab4fe956503f3f83d9c8f493eb99Tim Reddehase it 'should allow write on private readable repository' do
d60ddfb99765ab4fe956503f3f83d9c8f493eb99Tim Reddehase access = described_class.determine_permission('write', permission, repository)
9c3a9ea5002b6efbb3e3640fe215e63b8dfb619dTim Reddehase it 'should raise error on write to mirror repository' do
9c3a9ea5002b6efbb3e3640fe215e63b8dfb619dTim Reddehase repository.source_address = 'http://some_source_address.example.com'
9c3a9ea5002b6efbb3e3640fe215e63b8dfb619dTim Reddehase expect { described_class.determine_permission('write', permission, repository) }.
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should allow read on public readable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('read', permission, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should disallow write on public readable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('write', permission, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should allow read on public read-writeable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('read', permission, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should allow write on public read-writeable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('write', permission, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should allow read on private readable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('read', permission, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should disallow write on private readable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('write', permission, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should allow read on private read-writeable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('read', permission, repository)
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase it 'should allow write on private read-writeable repository' do
0dcf2700340141bc08344977e966e7ec095a8e8eTim Reddehase access = described_class.determine_permission('write', permission, repository)
9c3a9ea5002b6efbb3e3640fe215e63b8dfb619dTim Reddehase it 'should raise error on write to mirror repository' do
9c3a9ea5002b6efbb3e3640fe215e63b8dfb619dTim Reddehase repository.source_address = 'http://some_source_address.example.com'