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:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-12-21 21:04:58 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-01-03 21:13:32 +0300
commit2af3400c4eeb0227ca6f38117323a18e9fbd7d9b (patch)
tree5c11baa8654596e1108d6f16e42879b4cccdf07b
parentfcb967ac672e224737f6e170693e45331eb4d636 (diff)
Add spec for Project#write_repository_config
-rw-r--r--spec/models/project_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 1d4b68bdf8d..cea22bbd184 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -3155,4 +3155,26 @@ describe Project do
it { is_expected.to eq(platform_kubernetes) }
end
end
+
+ describe '#write_repository_config' do
+ set(:project) { create(:project, :repository) }
+
+ it 'writes full path in .git/config when key is missing' do
+ project.write_repository_config
+
+ expect(project.repo.config['gitlab.fullpath']).to eq project.full_path
+ end
+
+ it 'updates full path in .git/config when key is present' do
+ project.write_repository_config(gl_full_path: 'old/path')
+
+ expect { project.write_repository_config }.to change { project.repo.config['gitlab.fullpath'] }.from('old/path').to(project.full_path)
+ end
+
+ it 'does not raise an error with an empty repository' do
+ project = create(:project_empty_repo)
+
+ expect { project.write_repository_config }.not_to raise_error
+ end
+ end
end