Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-23 21:42:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-23 21:42:02 +0300
commit5a1541a44f745cf9ae4121d6919a1530a7212afe (patch)
tree3841ea24d9eaa1e5521f168348af3fd409aab962 /spec/lib
parentf1bc6c9f752e5dcf11f5798c70498e9ae4a8e3ec (diff)
Add latest changes from gitlab-org/gitlab@13-9-stable-ee
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/current_settings_spec.rb20
-rw-r--r--spec/lib/gitlab/import_export/repo_restorer_spec.rb2
-rw-r--r--spec/lib/object_storage/config_spec.rb63
3 files changed, 24 insertions, 61 deletions
diff --git a/spec/lib/gitlab/current_settings_spec.rb b/spec/lib/gitlab/current_settings_spec.rb
index 01aceec12c5..f5cb1987c5c 100644
--- a/spec/lib/gitlab/current_settings_spec.rb
+++ b/spec/lib/gitlab/current_settings_spec.rb
@@ -24,6 +24,26 @@ RSpec.describe Gitlab::CurrentSettings do
end
end
+ describe '.signup_disabled?' do
+ subject { described_class.signup_disabled? }
+
+ context 'when signup is enabled' do
+ before do
+ create(:application_setting, signup_enabled: true)
+ end
+
+ it { is_expected.to be_falsey }
+ end
+
+ context 'when signup is disabled' do
+ before do
+ create(:application_setting, signup_enabled: false)
+ end
+
+ it { is_expected.to be_truthy }
+ end
+ end
+
describe '#current_application_settings', :use_clean_rails_memory_store_caching do
it 'allows keys to be called directly' do
db_settings = create(:application_setting,
diff --git a/spec/lib/gitlab/import_export/repo_restorer_spec.rb b/spec/lib/gitlab/import_export/repo_restorer_spec.rb
index fe43a23e242..718a23f80a1 100644
--- a/spec/lib/gitlab/import_export/repo_restorer_spec.rb
+++ b/spec/lib/gitlab/import_export/repo_restorer_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe Gitlab::ImportExport::RepoRestorer do
context 'when the repository already exists' do
it 'deletes the existing repository before importing' do
allow(project.repository).to receive(:exists?).and_return(true)
- allow(project.repository).to receive(:path).and_return('repository_path')
+ allow(project.repository).to receive(:disk_path).and_return('repository_path')
expect_next_instance_of(Repositories::DestroyService) do |instance|
expect(instance).to receive(:execute).and_call_original
diff --git a/spec/lib/object_storage/config_spec.rb b/spec/lib/object_storage/config_spec.rb
index 1361d80fe75..0ead2a1d269 100644
--- a/spec/lib/object_storage/config_spec.rb
+++ b/spec/lib/object_storage/config_spec.rb
@@ -1,7 +1,8 @@
# frozen_string_literal: true
-require 'spec_helper'
+require 'fast_spec_helper'
require 'rspec-parameterized'
+require 'fog/core'
RSpec.describe ObjectStorage::Config do
using RSpec::Parameterized::TableSyntax
@@ -33,9 +34,7 @@ RSpec.describe ObjectStorage::Config do
}
end
- subject do
- described_class.new(raw_config.as_json)
- end
+ subject { described_class.new(raw_config.as_json) }
describe '#load_provider' do
before do
@@ -46,10 +45,6 @@ RSpec.describe ObjectStorage::Config do
it 'registers AWS as a provider' do
expect(Fog.providers.keys).to include(:aws)
end
-
- describe '#fog_connection' do
- it { expect(subject.fog_connection).to be_a_kind_of(Fog::AWS::Storage::Real) }
- end
end
context 'with Google' do
@@ -64,10 +59,6 @@ RSpec.describe ObjectStorage::Config do
it 'registers Google as a provider' do
expect(Fog.providers.keys).to include(:google)
end
-
- describe '#fog_connection' do
- it { expect(subject.fog_connection).to be_a_kind_of(Fog::Storage::GoogleXML::Real) }
- end
end
context 'with Azure' do
@@ -82,10 +73,6 @@ RSpec.describe ObjectStorage::Config do
it 'registers AzureRM as a provider' do
expect(Fog.providers.keys).to include(:azurerm)
end
-
- describe '#fog_connection' do
- it { expect(subject.fog_connection).to be_a_kind_of(Fog::Storage::AzureRM::Real) }
- end
end
end
@@ -183,50 +170,6 @@ RSpec.describe ObjectStorage::Config do
it { expect(subject.provider).to eq('AWS') }
it { expect(subject.aws?).to be true }
it { expect(subject.google?).to be false }
-
- it 'returns the default S3 endpoint' do
- subject.load_provider
-
- expect(subject.s3_endpoint).to eq("https://test-bucket.s3.amazonaws.com")
- end
-
- describe 'with a custom endpoint' do
- let(:endpoint) { 'https://my.example.com' }
-
- before do
- credentials[:endpoint] = endpoint
- end
-
- it 'returns the custom endpoint' do
- subject.load_provider
-
- expect(subject.s3_endpoint).to eq(endpoint)
- end
- end
-
- context 'with custom S3 host and port' do
- where(:host, :port, :scheme, :expected) do
- 's3.example.com' | 8080 | nil | 'https://test-bucket.s3.example.com:8080'
- 's3.example.com' | 443 | nil | 'https://test-bucket.s3.example.com'
- 's3.example.com' | 443 | "https" | 'https://test-bucket.s3.example.com'
- 's3.example.com' | nil | nil | 'https://test-bucket.s3.example.com'
- 's3.example.com' | 80 | "http" | 'http://test-bucket.s3.example.com'
- 's3.example.com' | "bogus" | nil | nil
- end
-
- with_them do
- before do
- credentials[:host] = host
- credentials[:port] = port
- credentials[:scheme] = scheme
- subject.load_provider
- end
-
- it 'returns expected host' do
- expect(subject.s3_endpoint).to eq(expected)
- end
- end
- end
end
context 'with Google credentials' do