Commit b245ee83 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'fixup-deployment-model' into 'master'

Make ref_path Private in Deployment

See merge request gitlab-org/gitlab!26310
parents cbc5922c 3e812b1f
...@@ -280,12 +280,12 @@ class Deployment < ApplicationRecord ...@@ -280,12 +280,12 @@ class Deployment < ApplicationRecord
errors.add(:ref, _('The branch or tag does not exist')) errors.add(:ref, _('The branch or tag does not exist'))
end end
private
def ref_path def ref_path
File.join(environment.ref_path, 'deployments', iid.to_s) File.join(environment.ref_path, 'deployments', iid.to_s)
end end
private
def legacy_finished_at def legacy_finished_at
self.created_at if success? && !read_attribute(:finished_at) self.created_at if success? && !read_attribute(:finished_at)
end end
......
...@@ -49,7 +49,7 @@ describe Deployments::AfterCreateService do ...@@ -49,7 +49,7 @@ describe Deployments::AfterCreateService do
it 'creates ref' do it 'creates ref' do
expect_any_instance_of(Repository) expect_any_instance_of(Repository)
.to receive(:create_ref) .to receive(:create_ref)
.with(deployment.sha, deployment.send(:ref_path)) .with(deployment.sha, "refs/environments/production/deployments/#{deployment.iid}")
service.execute service.execute
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment