Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <zegerjan@gitlab.com>2016-08-09 16:11:14 +0300
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-08-12 11:43:04 +0300
commit07fc2f852a0b4136b6d97c1d9773819c47e7e8e7 (patch)
treeb80f5200b1d7398eadc9b7ae029873f3cc6ad93a /spec/models/environment_spec.rb
parent03ea01946524a74773b24430c81804c2724b84b6 (diff)
Method names changed to #includes_commit?
Diffstat (limited to 'spec/models/environment_spec.rb')
-rw-r--r--spec/models/environment_spec.rb31
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