summaryrefslogtreecommitdiff
path: root/spec/models/commit_status_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/commit_status_spec.rb')
-rw-r--r--spec/models/commit_status_spec.rb49
1 files changed, 25 insertions, 24 deletions
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index 665a2a936af..d5e74d36b58 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -46,28 +46,10 @@ RSpec.describe CommitStatus do
describe 'status state machine' do
let!(:commit_status) { create(:commit_status, :running, project: project) }
- context 'when expire_job_and_pipeline_cache_synchronously is enabled' do
- before do
- stub_feature_flags(expire_job_and_pipeline_cache_synchronously: true)
- end
-
- it 'invalidates the cache after a transition' do
- expect(commit_status).to receive(:expire_etag_cache!)
+ it 'invalidates the cache after a transition' do
+ expect(commit_status).to receive(:expire_etag_cache!)
- commit_status.success!
- end
- end
-
- context 'when expire_job_and_pipeline_cache_synchronously is disabled' do
- before do
- stub_feature_flags(expire_job_and_pipeline_cache_synchronously: false)
- end
-
- it 'invalidates the cache after a transition' do
- expect(ExpireJobCacheWorker).to receive(:perform_async).with(commit_status.id)
-
- commit_status.success!
- end
+ commit_status.success!
end
describe 'transitioning to running' do
@@ -773,6 +755,26 @@ RSpec.describe CommitStatus do
expect { commit_status.drop! }.to change { commit_status.status }.from('manual').to('failed')
end
end
+
+ context 'when a failure reason is provided' do
+ context 'when a failure reason is a symbol' do
+ it 'correctly sets a failure reason' do
+ commit_status.drop!(:script_failure)
+
+ expect(commit_status).to be_script_failure
+ end
+ end
+
+ context 'when a failure reason is an object' do
+ it 'correctly sets a failure reason' do
+ reason = ::Gitlab::Ci::Build::Status::Reason.new(commit_status, :script_failure)
+
+ commit_status.drop!(reason)
+
+ expect(commit_status).to be_script_failure
+ end
+ end
+ end
end
describe 'ensure stage assignment' do
@@ -961,18 +963,17 @@ RSpec.describe CommitStatus do
describe '.bulk_insert_tags!' do
let(:statuses) { double('statuses') }
- let(:tag_list_by_build) { double('tag list') }
let(:inserter) { double('inserter') }
it 'delegates to bulk insert class' do
expect(Gitlab::Ci::Tags::BulkInsert)
.to receive(:new)
- .with(statuses, tag_list_by_build)
+ .with(statuses)
.and_return(inserter)
expect(inserter).to receive(:insert!)
- described_class.bulk_insert_tags!(statuses, tag_list_by_build)
+ described_class.bulk_insert_tags!(statuses)
end
end