diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-09-26 14:21:36 +0300 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2018-10-02 18:08:11 +0300 |
commit | 8ed7b34066464758e5cab955abb7a06b44c8e677 (patch) | |
tree | 1cb02ffe0aa0bb0b5f32ada195d80b8472617fee /spec/models/commit_status_spec.rb | |
parent | cc8b8a60b7ac9df0008192a489da6446c7fd5f89 (diff) |
Add unit tests for CommitStatus and Ci::Stage
Diffstat (limited to 'spec/models/commit_status_spec.rb')
-rw-r--r-- | spec/models/commit_status_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index f3f2bc28d2c..917685399d4 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -129,6 +129,20 @@ describe CommitStatus do end end + describe '#cancel' do + subject { job.cancel } + + context 'when status is scheduled' do + let(:job) { build(:commit_status, :scheduled) } + + it 'updates the status' do + subject + + expect(job).to be_canceled + end + end + end + describe '#auto_canceled?' do subject { commit_status.auto_canceled? } @@ -564,6 +578,12 @@ describe CommitStatus do it_behaves_like 'commit status enqueued' end + + context 'when initial state is :scheduled' do + let(:commit_status) { create(:commit_status, :scheduled) } + + it_behaves_like 'commit status enqueued' + end end describe '#present' do |