summaryrefslogtreecommitdiff
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-05-08 14:32:14 +0200
commit35802daadcb0e60060a83956efdf6b0bf0c4aa06 (patch)
treeae12b93d51931b1adfb0c14fc77c30f5ed097f00
parent262330ec07b43f2c15cb60a140ce60dbf62fc0c5 (diff)
downloadgitlab-ce-35802daadcb0e60060a83956efdf6b0bf0c4aa06.tar.gz
Add test for using overridden status method with scopes
-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 92971f59e14..5e79c5376a4 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -263,6 +263,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