summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-18 12:09:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-18 12:09:13 +0000
commit1363ca12f1f07c634647cf55c4c16b7401098673 (patch)
treed932caf09c8148322edb51ae954ed159ff7d00f8 /spec/support/shared_examples
parent6763d2787670bc03a36a8eb601703e88fc70dece (diff)
downloadgitlab-ce-1363ca12f1f07c634647cf55c4c16b7401098673.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r--spec/support/shared_examples/models/ci_variable_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/workers/gitlab/jira_import/jira_import_workers_shared_examples.rb32
2 files changed, 33 insertions, 1 deletions
diff --git a/spec/support/shared_examples/models/ci_variable_shared_examples.rb b/spec/support/shared_examples/models/ci_variable_shared_examples.rb
index 6cc922b4101..e5463f26369 100644
--- a/spec/support/shared_examples/models/ci_variable_shared_examples.rb
+++ b/spec/support/shared_examples/models/ci_variable_shared_examples.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.shared_examples 'CI variable' do
- it { is_expected.to include_module(HasVariable) }
+ it { is_expected.to include_module(Ci::HasVariable) }
describe "variable type" do
it 'defines variable types' do
diff --git a/spec/support/shared_examples/workers/gitlab/jira_import/jira_import_workers_shared_examples.rb b/spec/support/shared_examples/workers/gitlab/jira_import/jira_import_workers_shared_examples.rb
new file mode 100644
index 00000000000..5448526f954
--- /dev/null
+++ b/spec/support/shared_examples/workers/gitlab/jira_import/jira_import_workers_shared_examples.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+shared_examples 'include import workers modules' do
+ it { expect(described_class).to include_module(ApplicationWorker) }
+ it { expect(described_class).to include_module(Gitlab::JiraImport::QueueOptions) }
+
+ if described_class == Gitlab::JiraImport::Stage::StartImportWorker
+ it { expect(described_class).to include_module(ProjectStartImport) }
+ it { expect(described_class).to include_module(ProjectImportOptions) }
+ else
+ it { expect(described_class).to include_module(Gitlab::JiraImport::ImportWorker) }
+ end
+end
+
+shared_examples 'exit import not started' do
+ it 'does nothing, and exits' do
+ expect(Gitlab::JiraImport::AdvanceStageWorker).not_to receive(:perform_async)
+
+ worker.perform(project.id)
+ end
+end
+
+shared_examples 'advance to next stage' do |next_stage|
+ let(:job_waiter) { Gitlab::JobWaiter.new(2, 'some-job-key') }
+
+ it "advances to #{next_stage} stage" do
+ expect(Gitlab::JobWaiter).to receive(:new).and_return(job_waiter)
+ expect(Gitlab::JiraImport::AdvanceStageWorker).to receive(:perform_async).with(project.id, { job_waiter.key => job_waiter.jobs_remaining }, next_stage.to_sym)
+
+ worker.perform(project.id)
+ end
+end