diff options
author | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-08-03 14:37:39 +0300 |
---|---|---|
committer | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-08-11 22:29:57 +0300 |
commit | b497b0ce3fc3c1882639f9c7d55f7991ce41f15d (patch) | |
tree | 353668ef819c38e3e9a208530a36501b4c524313 /spec/models/deployment_spec.rb | |
parent | 826862d48ef80ddd849b9e3cb05ef37ba7be41e9 (diff) |
Incorporate feedback
Diffstat (limited to 'spec/models/deployment_spec.rb')
-rw-r--r-- | spec/models/deployment_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb index 7df3df4bb9e..107f8b38acf 100644 --- a/spec/models/deployment_spec.rb +++ b/spec/models/deployment_spec.rb @@ -15,4 +15,24 @@ describe Deployment, models: true do it { is_expected.to validate_presence_of(:ref) } it { is_expected.to validate_presence_of(:sha) } + + describe '#deployed_to?' do + let(:project) { create(:project) } + let(:environment) { create(:environment, project: project) } + let(:deployment) do + create(:deployment, environment: environment, sha: '5f923865dde3436854e9ceb9cdb7815618d4e849') + end + + context 'when there is no project commit' do + it 'returns false' do + expect(deployment.deployed_to?('random-branch')).to be false + end + end + + context 'when they share the same tree branch' do + it 'returns true' do + expect(deployment.deployed_to?('HEAD')).to be true + end + end + end end |