summaryrefslogtreecommitdiff
path: root/spec/services/import/bitbucket_server_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/import/bitbucket_server_service_spec.rb')
-rw-r--r--spec/services/import/bitbucket_server_service_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/services/import/bitbucket_server_service_spec.rb b/spec/services/import/bitbucket_server_service_spec.rb
index 56d93625b91..0b9fe10e95a 100644
--- a/spec/services/import/bitbucket_server_service_spec.rb
+++ b/spec/services/import/bitbucket_server_service_spec.rb
@@ -48,6 +48,23 @@ RSpec.describe Import::BitbucketServerService do
end
end
+ context 'when import source is disabled' do
+ before do
+ stub_application_setting(import_sources: nil)
+ allow(subject).to receive(:authorized?).and_return(true)
+ allow(client).to receive(:repo).with(project_key, repo_slug).and_return(double(repo))
+ end
+
+ it 'returns forbidden' do
+ result = subject.execute(credentials)
+
+ expect(result).to include(
+ status: :error,
+ http_status: :forbidden
+ )
+ end
+ end
+
context 'when user is unauthorized' do
before do
allow(subject).to receive(:authorized?).and_return(false)