Add a additional scope related to alive CI/CD statuses
This commit is contained in:
parent
d3762c2247
commit
f3ec51beba
|
@ -81,6 +81,7 @@ module HasStatus
|
|||
scope :canceled, -> { where(status: 'canceled') }
|
||||
scope :skipped, -> { where(status: 'skipped') }
|
||||
scope :manual, -> { where(status: 'manual') }
|
||||
scope :alive, -> { where(status: [:created, :pending, :running]) }
|
||||
scope :created_or_pending, -> { where(status: [:created, :pending]) }
|
||||
scope :running_or_pending, -> { where(status: [:running, :pending]) }
|
||||
scope :finished, -> { where(status: [:success, :failed, :canceled]) }
|
||||
|
|
|
@ -231,6 +231,18 @@ describe HasStatus do
|
|||
end
|
||||
end
|
||||
|
||||
describe '.alive' do
|
||||
subject { CommitStatus.alive }
|
||||
|
||||
%i[running pending created].each do |status|
|
||||
it_behaves_like 'containing the job', status
|
||||
end
|
||||
|
||||
%i[failed success].each do |status|
|
||||
it_behaves_like 'not containing the job', status
|
||||
end
|
||||
end
|
||||
|
||||
describe '.created_or_pending' do
|
||||
subject { CommitStatus.created_or_pending }
|
||||
|
||||
|
|
Loading…
Reference in New Issue