Add test for using overridden status method with scopes

This commit is contained in:
Grzegorz Bizon 2017-05-08 14:32:14 +02:00
parent 26092b5158
commit e538963d80
1 changed files with 11 additions and 0 deletions

View File

@ -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