summaryrefslogtreecommitdiff
path: root/spec/models/deployment_spec.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-08-17 13:30:12 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-08-17 13:30:12 +0800
commitec4549e4b5ffcc608041fd7f71cf0aa8dc18151f (patch)
tree3cdd2b646a0a4a03de900fbbd72d4e1005a64f5b /spec/models/deployment_spec.rb
parent74c5f82fb034f3d25f4c32fb0fac93beb6b4623f (diff)
parent1b338d59f641ce629cbecb839b64c9fd65561276 (diff)
downloadgitlab-ce-ec4549e4b5ffcc608041fd7f71cf0aa8dc18151f.tar.gz
Merge remote-tracking branch 'upstream/master' into wall-clock-time-for-showing-pipeline
* upstream/master: (99 commits) Update CHANGELOG for 8.10.6, 8.9.7, and 8.8.8 Updated Akismet documentation Add hover state to todos (!5361) Load issues and merge requests templates from repository Backport EE assertions in protected branch related specs. Revert "Merge branch '19957-write-tests-for-adding-comments-for-different-line-types-in-diff' into 'master'" Fix a missed `before_action` for `AutocompleteController`. Backport `AutocompleteController#load_project` from EE!581. Fix API::BranchesSpec. Fix failing tests relating to backporting ee!581. Revert unrelevant changes Fix the protected branches factory. Improve EE compatibility with protected branch access levels. Move the "update" portion of the protected branch view into a partial. Don't select an access level if already selected. Backport changes from gitlab-org/gitlab-ee!581 to CE. Further refactor and syntax fixes. Upgrade httpclient gem from 2.7.0.1 to 2.8.2. Make rubocop happy Make rubocop happy ...
Diffstat (limited to 'spec/models/deployment_spec.rb')
-rw-r--r--spec/models/deployment_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb
index 7df3df4bb9e..bfff639ad78 100644
--- a/spec/models/deployment_spec.rb
+++ b/spec/models/deployment_spec.rb
@@ -15,4 +15,28 @@ describe Deployment, models: true do
it { is_expected.to validate_presence_of(:ref) }
it { is_expected.to validate_presence_of(:sha) }
+
+ describe '#includes_commit?' do
+ let(:project) { create(:project) }
+ let(:environment) { create(:environment, project: project) }
+ let(:deployment) do
+ create(:deployment, environment: environment, sha: project.commit.id)
+ end
+
+ context 'when there is no project commit' do
+ it 'returns false' do
+ commit = project.commit('feature')
+
+ expect(deployment.includes_commit?(commit)).to be false
+ end
+ end
+
+ context 'when they share the same tree branch' do
+ it 'returns true' do
+ commit = project.commit
+
+ expect(deployment.includes_commit?(commit)).to be true
+ end
+ end
+ end
end