diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-12 12:09:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-12 12:09:55 +0300 |
commit | 18f7828977b74bf6e5153594a098ef90e773b3b7 (patch) | |
tree | 49cb1e16d5341d773807ee583357ae6eb167d61f /spec/lib/gitlab | |
parent | 8191b1571c017378eac33b3ed296ad5216d0a410 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab')
4 files changed, 40 insertions, 0 deletions
diff --git a/spec/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy_spec.rb b/spec/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy_spec.rb index 86ceb97b250..1631de393b5 100644 --- a/spec/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy_spec.rb +++ b/spec/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy_spec.rb @@ -3,6 +3,12 @@ require 'spec_helper' describe Gitlab::ImportExport::AfterExportStrategies::BaseAfterExportStrategy do + before do + allow_next_instance_of(ProjectExportWorker) do |job| + allow(job).to receive(:jid).and_return(SecureRandom.hex(8)) + end + end + let!(:service) { described_class.new } let!(:project) { create(:project, :with_export) } let(:shared) { project.import_export_shared } diff --git a/spec/lib/gitlab/import_export/after_export_strategies/web_upload_strategy_spec.rb b/spec/lib/gitlab/import_export/after_export_strategies/web_upload_strategy_spec.rb index 95c47d15f8f..7792daed99c 100644 --- a/spec/lib/gitlab/import_export/after_export_strategies/web_upload_strategy_spec.rb +++ b/spec/lib/gitlab/import_export/after_export_strategies/web_upload_strategy_spec.rb @@ -5,6 +5,12 @@ require 'spec_helper' describe Gitlab::ImportExport::AfterExportStrategies::WebUploadStrategy do include StubRequests + before do + allow_next_instance_of(ProjectExportWorker) do |job| + allow(job).to receive(:jid).and_return(SecureRandom.hex(8)) + end + end + let(:example_url) { 'http://www.example.com' } let(:strategy) { subject.new(url: example_url, http_method: 'post') } let!(:project) { create(:project, :with_export) } diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml index e579c8474b7..37b3e4a4a22 100644 --- a/spec/lib/gitlab/import_export/all_models.yml +++ b/spec/lib/gitlab/import_export/all_models.yml @@ -469,6 +469,7 @@ project: - autoclose_referenced_issues - status_page_setting - requirements +- export_jobs award_emoji: - awardable - user diff --git a/spec/lib/gitlab/quick_actions/extractor_spec.rb b/spec/lib/gitlab/quick_actions/extractor_spec.rb index 1843acb0cc0..6ea597bf01e 100644 --- a/spec/lib/gitlab/quick_actions/extractor_spec.rb +++ b/spec/lib/gitlab/quick_actions/extractor_spec.rb @@ -291,6 +291,33 @@ describe Gitlab::QuickActions::Extractor do expect(msg).to eq expected end + it 'does not extract commands in multiline inline code on seperated rows' do + msg = "Hello\r\n`\r\nThis is some text\r\n/close\r\n/assign @user\r\n`\r\n\r\nWorld" + expected = msg.delete("\r") + msg, commands = extractor.extract_commands(msg) + + expect(commands).to be_empty + expect(msg).to eq expected + end + + it 'does not extract commands in multiline inline code starting from text' do + msg = "Hello `This is some text\r\n/close\r\n/assign @user\r\n`\r\n\r\nWorld" + expected = msg.delete("\r") + msg, commands = extractor.extract_commands(msg) + + expect(commands).to be_empty + expect(msg).to eq expected + end + + it 'does not extract commands in inline code' do + msg = "`This is some text\r\n/close\r\n/assign @user\r\n`\r\n\r\nWorld" + expected = msg.delete("\r") + msg, commands = extractor.extract_commands(msg) + + expect(commands).to be_empty + expect(msg).to eq expected + end + it 'limits to passed commands when they are passed' do msg = <<~MSG.strip Hello, we should only extract the commands passed |