From e538963d80872e3844ba345967cfa0bf3821c82a Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 8 May 2017 14:32:14 +0200 Subject: Add test for using overridden status method with scopes --- spec/models/commit_status_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 -- cgit v1.2.1