diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bin/sidekiq_cluster_spec.rb | 13 | ||||
-rw-r--r-- | spec/frontend/repository/components/preview/__snapshots__/index_spec.js.snap | 1 | ||||
-rw-r--r-- | spec/lib/gitlab/git_access_snippet_spec.rb | 10 | ||||
-rw-r--r-- | spec/models/merge_request_diff_spec.rb | 35 |
4 files changed, 53 insertions, 6 deletions
diff --git a/spec/bin/sidekiq_cluster_spec.rb b/spec/bin/sidekiq_cluster_spec.rb index 67de55ad9f5..c0240214a6b 100644 --- a/spec/bin/sidekiq_cluster_spec.rb +++ b/spec/bin/sidekiq_cluster_spec.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require 'spec_helper' +require 'shellwords' describe 'bin/sidekiq-cluster' do using RSpec::Parameterized::TableSyntax @@ -18,9 +19,9 @@ describe 'bin/sidekiq-cluster' do output, status = Gitlab::Popen.popen(cmd, Rails.root.to_s) expect(status).to be(0) - expect(output).to include('"bundle", "exec", "sidekiq"') - expect(output).to include(included) - expect(output).not_to include(excluded) + expect(output).to include('bundle exec sidekiq') + expect(Shellwords.split(output)).to include(included) + expect(Shellwords.split(output)).not_to include(excluded) end end end @@ -36,9 +37,9 @@ describe 'bin/sidekiq-cluster' do output, status = Gitlab::Popen.popen(cmd, Rails.root.to_s) expect(status).to be(0) - expect(output).to include('"bundle", "exec", "sidekiq"') - expect(output).to include('-qdefault,1') - expect(output).to include('-qcronjob:ci_archive_traces_cron,1') + expect(output).to include('bundle exec sidekiq') + expect(Shellwords.split(output)).to include('-qdefault,1') + expect(Shellwords.split(output)).to include('-qcronjob:ci_archive_traces_cron,1') end end end diff --git a/spec/frontend/repository/components/preview/__snapshots__/index_spec.js.snap b/spec/frontend/repository/components/preview/__snapshots__/index_spec.js.snap index 8eeae9b8455..69b7a3931f8 100644 --- a/spec/frontend/repository/components/preview/__snapshots__/index_spec.js.snap +++ b/spec/frontend/repository/components/preview/__snapshots__/index_spec.js.snap @@ -27,6 +27,7 @@ exports[`Repository file preview component renders file HTML 1`] = ` <div class="blob-viewer" + data-qa-selector="blob_viewer_content" > <div> <div diff --git a/spec/lib/gitlab/git_access_snippet_spec.rb b/spec/lib/gitlab/git_access_snippet_spec.rb index f52fe8ef612..877a760152d 100644 --- a/spec/lib/gitlab/git_access_snippet_spec.rb +++ b/spec/lib/gitlab/git_access_snippet_spec.rb @@ -209,6 +209,16 @@ describe Gitlab::GitAccessSnippet do expect { push_access_check }.to raise_forbidden('foo') end + + context 'when feature flag :snippet_count_check is disabled' do + it 'does not check push file count' do + stub_feature_flags(snippet_count_check: false) + + expect(Gitlab::Checks::PushFileCountCheck).not_to receive(:new) + + expect { push_access_check }.not_to raise_error + end + end end private diff --git a/spec/models/merge_request_diff_spec.rb b/spec/models/merge_request_diff_spec.rb index 8167241faa8..6d2ad3f0475 100644 --- a/spec/models/merge_request_diff_spec.rb +++ b/spec/models/merge_request_diff_spec.rb @@ -156,6 +156,41 @@ describe MergeRequestDiff do end end + describe '#migrate_files_to_database!' do + let(:diff) { create(:merge_request).merge_request_diff } + + it 'converts from external to in-database storage' do + stub_external_diffs_setting(enabled: true) + + expect(diff).to be_stored_externally + expect(diff).to receive(:update!).and_call_original + + file = diff.external_diff + file_data = file.read + diff.migrate_files_to_database! + + expect(diff).not_to be_stored_externally + expect(file).not_to exist + expect(diff.merge_request_diff_files.map(&:diff).join('')).to eq(file_data) + end + + it 'does nothing with an in-database diff' do + expect(diff).not_to be_stored_externally + expect(diff).not_to receive(:update!) + + diff.migrate_files_to_database! + end + + it 'does nothing with an empty diff' do + stub_external_diffs_setting(enabled: true) + MergeRequestDiffFile.where(merge_request_diff_id: diff.id).delete_all + + expect(diff).not_to receive(:update!) + + diff.migrate_files_to_database! + end + end + describe '#latest?' do let!(:mr) { create(:merge_request, :with_diffs) } let!(:first_diff) { mr.merge_request_diff } |