Add spec for Project#write_repository_config

parent fcb967ac
...@@ -3155,4 +3155,26 @@ describe Project do ...@@ -3155,4 +3155,26 @@ describe Project do
it { is_expected.to eq(platform_kubernetes) } it { is_expected.to eq(platform_kubernetes) }
end end
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 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