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-05-20 17:34:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 17:34:42 +0300
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /spec/models/commit_status_spec.rb
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/models/commit_status_spec.rb')
-rw-r--r--spec/models/commit_status_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index 73b81b2225a..05d3329215a 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -751,4 +751,48 @@ describe CommitStatus do
it { is_expected.to be_a(CommitStatusPresenter) }
end
+
+ describe '#recoverable?' do
+ using RSpec::Parameterized::TableSyntax
+
+ let(:commit_status) { create(:commit_status, :pending) }
+
+ subject(:recoverable?) { commit_status.recoverable? }
+
+ context 'when commit status is failed' do
+ before do
+ commit_status.drop!
+ end
+
+ where(:failure_reason, :recoverable) do
+ :script_failure | false
+ :missing_dependency_failure | false
+ :archived_failure | false
+ :scheduler_failure | false
+ :data_integrity_failure | false
+ :unknown_failure | true
+ :api_failure | true
+ :stuck_or_timeout_failure | true
+ :runner_system_failure | true
+ end
+
+ with_them do
+ context "when failure reason is #{params[:failure_reason]}" do
+ before do
+ commit_status.update_attribute(:failure_reason, failure_reason)
+ end
+
+ it { is_expected.to eq(recoverable) }
+ end
+ end
+ end
+
+ context 'when commit status is not failed' do
+ before do
+ commit_status.success!
+ end
+
+ it { is_expected.to eq(false) }
+ end
+ end
end