summaryrefslogtreecommitdiff
path: root/spec/models/commit_status_spec.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-08 14:26:08 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-06-20 15:32:29 +0200
commit21f3e9ce2617b8869583bdae60cc619bcd0a29bd (patch)
tree8aecc2f70d260a37da98a8baea2fb4912a10443b /spec/models/commit_status_spec.rb
parent64e09a1b35cc1897df7e46e73989c6e7013f6196 (diff)
downloadgitlab-ce-21f3e9ce2617b8869583bdae60cc619bcd0a29bd.tar.gz
Move custom compound status method to commit status
Diffstat (limited to 'spec/models/commit_status_spec.rb')
-rw-r--r--spec/models/commit_status_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index 9262ce08987..2ee9620228c 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -284,6 +284,30 @@ describe CommitStatus, :models do
end
end
+ describe '.status' do
+ context 'when there are multiple statuses present' do
+ before do
+ create_status(status: 'running')
+ create_status(status: 'success')
+ create_status(allow_failure: true, status: 'failed')
+ end
+
+ it 'returns a correct compound status' do
+ expect(described_class.all.status).to eq 'running'
+ end
+ end
+
+ context 'when there are only allowed to fail commit statuses present' do
+ before do
+ create_status(allow_failure: true, status: 'failed')
+ end
+
+ it 'returns status that indicates success' do
+ expect(described_class.all.status).to eq 'success'
+ end
+ end
+ end
+
describe '#before_sha' do
subject { commit_status.before_sha }