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>2023-12-23 00:10:39 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-23 00:10:39 +0300
commit6c68583a42998b0bb15971785f372197bfc55cd7 (patch)
tree1299dcd6bda4cf7240f85a450fcfddb1f4053320 /spec/support
parente5f8220301d524167441f8fac5fd5fcf5fc31e1f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/ci/runner_with_status_scope_shared_examples.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/support/shared_examples/ci/runner_with_status_scope_shared_examples.rb b/spec/support/shared_examples/ci/runner_with_status_scope_shared_examples.rb
new file mode 100644
index 00000000000..510721d66b2
--- /dev/null
+++ b/spec/support/shared_examples/ci/runner_with_status_scope_shared_examples.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+RSpec.shared_examples 'runner with status scope' do
+ describe '.with_status' do
+ subject(:scope) { described_class.with_status(status) }
+
+ described_class::AVAILABLE_STATUSES.each do |status|
+ context "with #{status} status" do
+ let(:status) { status }
+
+ it "calls corresponding :#{status} scope" do
+ expect(described_class).to receive(status.to_sym).and_call_original
+
+ scope
+ end
+ end
+ end
+
+ context 'with invalid status' do
+ let(:status) { :invalid_status }
+
+ it 'returns all records' do
+ expect(described_class).to receive(:all).at_least(:once).and_call_original
+
+ expect { scope }.not_to raise_error
+ end
+ end
+ end
+end