summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-26 12:07:48 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-26 12:07:48 +0000
commitef31adeb0fb9a02b2c6a4529ec4e38d7082a4b2b (patch)
treef0ee2b8bdffd7f91ad0b31388562c90825179585 /spec/support/shared_examples
parent7e019504f5ac6decde690565857238e7e59aa034 (diff)
downloadgitlab-ce-ef31adeb0fb9a02b2c6a4529ec4e38d7082a4b2b.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r--spec/support/shared_examples/graphql/jira_import/jira_import_resolved_shared_examples.rb15
-rw-r--r--spec/support/shared_examples/lib/gitlab/jira_import/base_importer_shared_examples.rb5
-rw-r--r--spec/support/shared_examples/workers/gitlab/jira_import/jira_import_workers_shared_examples.rb6
3 files changed, 23 insertions, 3 deletions
diff --git a/spec/support/shared_examples/graphql/jira_import/jira_import_resolved_shared_examples.rb b/spec/support/shared_examples/graphql/jira_import/jira_import_resolved_shared_examples.rb
new file mode 100644
index 00000000000..b1d178521bb
--- /dev/null
+++ b/spec/support/shared_examples/graphql/jira_import/jira_import_resolved_shared_examples.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+shared_examples 'no jira import data present' do
+ it 'returns none' do
+ expect(resolve_imports).to eq JiraImportData.none
+ end
+end
+
+shared_examples 'no jira import access' do
+ it 'raises error' do
+ expect do
+ resolve_imports
+ end.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable)
+ end
+end
diff --git a/spec/support/shared_examples/lib/gitlab/jira_import/base_importer_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/jira_import/base_importer_shared_examples.rb
new file mode 100644
index 00000000000..85dcc053447
--- /dev/null
+++ b/spec/support/shared_examples/lib/gitlab/jira_import/base_importer_shared_examples.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+shared_examples 'raise exception if not implemented' do
+ it { expect { described_class.new(project).imported_items_cache_key }.not_to raise_error }
+end
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
index 5448526f954..71ec1ea6a74 100644
--- 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
@@ -16,7 +16,7 @@ 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)
+ described_class.new.perform(project.id)
end
end
@@ -25,8 +25,8 @@ shared_examples 'advance to next stage' do |next_stage|
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)
+ expect(Gitlab::JiraImport::AdvanceStageWorker).to receive(:perform_async).with(project.id, { job_waiter.key => job_waiter.jobs_remaining }, next_stage.to_sym).and_return([])
- worker.perform(project.id)
+ described_class.new.perform(project.id)
end
end