diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-03 03:05:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-03 03:05:59 +0300 |
commit | 427b23c12718bea233931431e7d9307881a960c0 (patch) | |
tree | 5e15672783c950a5e68dd89517d7888e652e01a7 /spec/lib | |
parent | 6d60f910762c1a92a07a4afaf1b26962f75ee4b6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
6 files changed, 14 insertions, 10 deletions
diff --git a/spec/lib/gitlab/background_migration/legacy_upload_mover_spec.rb b/spec/lib/gitlab/background_migration/legacy_upload_mover_spec.rb index 7d67dc0251d..c1eaf1d3433 100644 --- a/spec/lib/gitlab/background_migration/legacy_upload_mover_spec.rb +++ b/spec/lib/gitlab/background_migration/legacy_upload_mover_spec.rb @@ -32,7 +32,7 @@ describe Gitlab::BackgroundMigration::LegacyUploadMover do if with_file upload = create(:upload, :with_file, :attachment_upload, params) - model.update(attachment: upload.build_uploader) + model.update(attachment: upload.retrieve_uploader) model.attachment.upload else create(:upload, :attachment_upload, params) diff --git a/spec/lib/gitlab/background_migration/legacy_uploads_migrator_spec.rb b/spec/lib/gitlab/background_migration/legacy_uploads_migrator_spec.rb index ed8cbfeb11f..cabca3dbef9 100644 --- a/spec/lib/gitlab/background_migration/legacy_uploads_migrator_spec.rb +++ b/spec/lib/gitlab/background_migration/legacy_uploads_migrator_spec.rb @@ -24,7 +24,7 @@ describe Gitlab::BackgroundMigration::LegacyUploadsMigrator do if with_file upload = create(:upload, :with_file, :attachment_upload, params) - model.update(attachment: upload.build_uploader) + model.update(attachment: upload.retrieve_uploader) model.attachment.upload else create(:upload, :attachment_upload, params) diff --git a/spec/lib/gitlab/import_export/uploads_manager_spec.rb b/spec/lib/gitlab/import_export/uploads_manager_spec.rb index 792117e1df1..f13f639d6b7 100644 --- a/spec/lib/gitlab/import_export/uploads_manager_spec.rb +++ b/spec/lib/gitlab/import_export/uploads_manager_spec.rb @@ -83,7 +83,7 @@ describe Gitlab::ImportExport::UploadsManager do it 'restores the file' do manager.restore - expect(project.uploads.map { |u| u.build_uploader.filename }).to include('dummy.txt') + expect(project.uploads.map { |u| u.retrieve_uploader.filename }).to include('dummy.txt') end end end diff --git a/spec/lib/gitlab/import_export/uploads_restorer_spec.rb b/spec/lib/gitlab/import_export/uploads_restorer_spec.rb index 6072f18b8c7..e2e8204b2fa 100644 --- a/spec/lib/gitlab/import_export/uploads_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/uploads_restorer_spec.rb @@ -27,7 +27,7 @@ describe Gitlab::ImportExport::UploadsRestorer do it 'copies the uploads to the project path' do subject.restore - expect(project.uploads.map { |u| u.build_uploader.filename }).to include('dummy.txt') + expect(project.uploads.map { |u| u.retrieve_uploader.filename }).to include('dummy.txt') end end @@ -43,7 +43,7 @@ describe Gitlab::ImportExport::UploadsRestorer do it 'copies the uploads to the project path' do subject.restore - expect(project.uploads.map { |u| u.build_uploader.filename }).to include('dummy.txt') + expect(project.uploads.map { |u| u.retrieve_uploader.filename }).to include('dummy.txt') end end end diff --git a/spec/lib/gitlab/sanitizers/exif_spec.rb b/spec/lib/gitlab/sanitizers/exif_spec.rb index f882dbbdb5c..11e430e0be4 100644 --- a/spec/lib/gitlab/sanitizers/exif_spec.rb +++ b/spec/lib/gitlab/sanitizers/exif_spec.rb @@ -58,7 +58,7 @@ describe Gitlab::Sanitizers::Exif do end describe '#clean' do - let(:uploader) { create(:upload, :with_file, :issuable_upload).build_uploader } + let(:uploader) { create(:upload, :with_file, :issuable_upload).retrieve_uploader } context "no dry run" do it "removes exif from the image" do diff --git a/spec/lib/gitlab_spec.rb b/spec/lib/gitlab_spec.rb index ccb5cb3aa43..7e318017a05 100644 --- a/spec/lib/gitlab_spec.rb +++ b/spec/lib/gitlab_spec.rb @@ -71,26 +71,30 @@ describe Gitlab do end describe '.com?' do + before do + Thread.current[:is_com] = nil + end + it 'is true when on GitLab.com' do - stub_config_setting(url: 'https://gitlab.com') + allow(LightSettings).to receive(:host).and_return('gitlab.com') expect(described_class.com?).to eq true end it 'is true when on staging' do - stub_config_setting(url: 'https://staging.gitlab.com') + allow(LightSettings).to receive(:host).and_return('staging.gitlab.com') expect(described_class.com?).to eq true end it 'is true when on other gitlab subdomain' do - stub_config_setting(url: 'https://example.gitlab.com') + allow(LightSettings).to receive(:host).and_return('example.gitlab.com') expect(described_class.com?).to eq true end it 'is false when not on GitLab.com' do - stub_config_setting(url: 'http://example.com') + allow(LightSettings).to receive(:host).and_return('example.com') expect(described_class.com?).to eq false end |