Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-06 09:09:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-06 09:09:19 +0300
commitcce8cf03d3bebe8b05375e4db0004328f84b28a2 (patch)
treec4fe6a257e894b6ce226a36f275f35675025c299 /spec/support/shared_examples
parentf098e6d3d2c8eaaec0a228c8a3ae01f770e15dd2 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r--spec/support/shared_examples/models/jira_import_state_shared_examples.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/support/shared_examples/models/jira_import_state_shared_examples.rb b/spec/support/shared_examples/models/jira_import_state_shared_examples.rb
new file mode 100644
index 00000000000..f4643375c8e
--- /dev/null
+++ b/spec/support/shared_examples/models/jira_import_state_shared_examples.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+shared_examples 'multiple running imports not allowed' do
+ it 'returns not valid' do
+ new_import = build(:jira_import_state, project: project)
+
+ expect(new_import).not_to be_valid
+ expect(new_import.errors[:project]).not_to be_nil
+ end
+end
+
+shared_examples 'in progress' do |status|
+ it 'returns true' do
+ jira_import_state = build(:jira_import_state, status: status)
+ expect(jira_import_state).to be_in_progress
+ end
+end
+
+shared_examples 'not in progress' do |status|
+ it 'returns false' do
+ jira_import_state = build(:jira_import_state, status: status)
+ expect(jira_import_state).not_to be_in_progress
+ end
+end
+
+shared_examples 'can transition' do |states|
+ states.each do |state|
+ it 'returns true' do
+ expect(jira_import.send(state)).to be true
+ end
+ end
+end
+
+shared_examples 'cannot transition' do |states|
+ states.each do |state|
+ it 'returns false' do
+ expect(jira_import.send(state)).to be false
+ end
+ end
+end