summaryrefslogtreecommitdiff
path: root/spec/models/commit_status_spec.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-08 14:32:14 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-06-20 15:32:29 +0200
commite538963d80872e3844ba345967cfa0bf3821c82a (patch)
tree1287e859e25b2b2ad65bf16d98710a129c8288f3 /spec/models/commit_status_spec.rb
parent26092b5158d61f353b66a38d5034f3cb6e567ffa (diff)
downloadgitlab-ce-e538963d80872e3844ba345967cfa0bf3821c82a.tar.gz
Add test for using overridden status method with scopes
Diffstat (limited to 'spec/models/commit_status_spec.rb')
-rw-r--r--spec/models/commit_status_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index 2ee9620228c..dc348f6cd33 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -306,6 +306,17 @@ describe CommitStatus, :models do
expect(described_class.all.status).to eq 'success'
end
end
+
+ context 'when using a scope to select latest statuses' do
+ before do
+ create_status(name: 'test', status: 'failed')
+ create_status(allow_failure: true, name: 'test', status: 'failed')
+ end
+
+ it 'returns status according to the scope' do
+ expect(described_class.latest.status).to eq 'success'
+ end
+ end
end
describe '#before_sha' do