diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-01 12:17:40 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-01 12:17:40 +0000 |
commit | 5e98d2784081393aea84b6591116d905da6eb567 (patch) | |
tree | f18117de3f067c2511861c3d2343b7c951032dae /spec/controllers/import/bitbucket_controller_spec.rb | |
parent | 2655540094e856f3048fb737a19e4316d8264623 (diff) | |
download | gitlab-ce-5e98d2784081393aea84b6591116d905da6eb567.tar.gz |
Add latest changes from gitlab-org/security/gitlab@15-10-stable-ee
Diffstat (limited to 'spec/controllers/import/bitbucket_controller_spec.rb')
-rw-r--r-- | spec/controllers/import/bitbucket_controller_spec.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/controllers/import/bitbucket_controller_spec.rb b/spec/controllers/import/bitbucket_controller_spec.rb index 055c98ebdbc..906cc5cb336 100644 --- a/spec/controllers/import/bitbucket_controller_spec.rb +++ b/spec/controllers/import/bitbucket_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Import::BitbucketController do +RSpec.describe Import::BitbucketController, feature_category: :importers do include ImportSpecHelper let(:user) { create(:user) } @@ -445,5 +445,16 @@ RSpec.describe Import::BitbucketController do ) end end + + context 'when user can not import projects' do + let!(:other_namespace) { create(:group, name: 'other_namespace').tap { |other_namespace| other_namespace.add_developer(user) } } + + it 'returns 422 response' do + post :create, params: { target_namespace: other_namespace.name }, format: :json + + expect(response).to have_gitlab_http_status(:unprocessable_entity) + expect(response.parsed_body['errors']).to eq('You are not allowed to import projects in this namespace.') + end + end end end |