diff options
author | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-08-09 15:11:14 +0200 |
---|---|---|
committer | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-08-12 10:43:04 +0200 |
commit | 07fc2f852a0b4136b6d97c1d9773819c47e7e8e7 (patch) | |
tree | b80f5200b1d7398eadc9b7ae029873f3cc6ad93a /spec/models/environment_spec.rb | |
parent | 03ea01946524a74773b24430c81804c2724b84b6 (diff) | |
download | gitlab-ce-07fc2f852a0b4136b6d97c1d9773819c47e7e8e7.tar.gz |
Method names changed to #includes_commit?zj-deployment-status-on-mr
Diffstat (limited to 'spec/models/environment_spec.rb')
-rw-r--r-- | spec/models/environment_spec.rb | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index e65b4f82eff..c881897926e 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -31,12 +31,35 @@ describe Environment, models: true do end end - describe '#deployed_from?' do - let(:environment) { create(:environment) } - + describe '#includes_commit?' do context 'without a last deployment' do it "returns false" do - expect(environment.deployed_from?('HEAD')).to be false + expect(environment.includes_commit?('HEAD')).to be false + end + end + + context 'with a last deployment' do + let(:project) { create(:project) } + let(:environment) { create(:environment, project: project) } + + let!(:deployment) do + create(:deployment, environment: environment, sha: project.commit('master').id) + end + + context 'in the same branch' do + it 'returns true' do + expect(environment.includes_commit?(RepoHelpers.sample_commit)).to be true + end + end + + context 'not in the same branch' do + before do + deployment.update(sha: project.commit('feature').id) + end + + it 'returns false' do + expect(environment.includes_commit?(RepoHelpers.sample_commit)).to be false + end end end end |