Commit 753c3ee3 authored by Toon Claes's avatar Toon Claes

Rename method to Project#track_project_repository

This is a more sensible name to make clear it tracks it in the
database and not just saves it on disk.
parent 53964aca
......@@ -120,7 +120,7 @@ class Project < ActiveRecord::Base
after_create :ensure_storage_path_exists
after_save :ensure_storage_path_exists, if: :namespace_id_changed?
after_create :save_project_repository
after_create :track_project_repository
acts_as_ordered_taggable
......@@ -1210,7 +1210,7 @@ class Project < ActiveRecord::Base
false
end
def save_project_repository
def track_project_repository
return unless hashed_storage?(:repository)
project_repo = project_repository || build_project_repository
......
......@@ -32,7 +32,7 @@ module Projects
if result
project.write_repository_config
project.create_project_repository
project.track_project_repository
else
rollback_folder_move
project.storage_version = nil
......
......@@ -1730,11 +1730,11 @@ describe Project do
end
end
describe '#save_project_repository' do
describe '#track_project_repository' do
let(:project) { create(:project, :repository) }
it 'creates a project_repository' do
project.save_project_repository
project.track_project_repository
expect(project.reload.project_repository).to be_present
expect(project.project_repository.disk_path).to eq(project.disk_path)
......@@ -1742,12 +1742,12 @@ describe Project do
end
it 'updates the project_repository' do
project.save_project_repository
project.track_project_repository
allow(project).to receive(:disk_path).and_return('@fancy/new/path')
expect do
project.save_project_repository
project.track_project_repository
end.not_to change(ProjectRepository, :count)
expect(project.reload.project_repository.disk_path).to eq(project.disk_path)
......
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