diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-24 00:08:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-24 00:08:35 +0300 |
commit | 24256212ea84e6fb6509f6fb317a2d2bac3d0d06 (patch) | |
tree | e4300d70d8e724179d9de657a68d88462aaaf04a /spec/services | |
parent | d933bc5a8738d24898c5a82cc72ee9bd050425e6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/groups/import_export/export_service_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/services/groups/import_export/export_service_spec.rb b/spec/services/groups/import_export/export_service_spec.rb index 2024e1ed457..b1f76964722 100644 --- a/spec/services/groups/import_export/export_service_spec.rb +++ b/spec/services/groups/import_export/export_service_spec.rb @@ -10,6 +10,10 @@ describe Groups::ImportExport::ExportService do let(:export_path) { shared.export_path } let(:service) { described_class.new(group: group, user: user, params: { shared: shared }) } + before do + group.add_owner(user) + end + after do FileUtils.rm_rf(export_path) end @@ -30,6 +34,18 @@ describe Groups::ImportExport::ExportService do end end + context 'when user does not have admin_group permission' do + let!(:another_user) { create(:user) } + let(:service) { described_class.new(group: group, user: another_user, params: { shared: shared }) } + + it 'fails' do + expected_message = + "User with ID: %s does not have permission to Group %s with ID: %s." % + [another_user.id, group.name, group.id] + expect { service.execute }.to raise_error(Gitlab::ImportExport::Error).with_message(expected_message) + end + end + context 'when saving services fail' do before do allow(service).to receive_message_chain(:tree_exporter, :save).and_return(false) |