diff options
author | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2017-12-04 13:29:25 +0300 |
---|---|---|
committer | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2017-12-12 18:05:38 +0300 |
commit | dad4c0b645d499c93fba14ce1e691da151929071 (patch) | |
tree | 4c06fa010755af6a3cbaf0f795f9f1681665144b /spec | |
parent | 2a181d68c810e89ff5d2e49999775d8b58adb394 (diff) |
Move Repository#write_ref to Git::Repository#write_ref
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/project_spec.rb | 5 | ||||
-rw-r--r-- | spec/models/repository_spec.rb | 17 |
2 files changed, 20 insertions, 2 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index f4699fd243d..dd9e8498519 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -1863,10 +1863,11 @@ describe Project do project.change_head(project.default_branch) end - it 'creates the new reference with rugged' do - expect(project.repository.rugged.references).to receive(:create).with('HEAD', + it 'creates the new reference' do + expect(project.repository.raw_repository).to receive(:write_ref).with('HEAD', "refs/heads/#{project.default_branch}", force: true) + project.change_head(project.default_branch) end diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 358bc3dfb94..129fce74f45 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -1916,6 +1916,23 @@ describe Repository do File.delete(path) end + + it "attempting to call keep_around when exists a lock does not fail" do + ref = repository.send(:keep_around_ref_name, sample_commit.id) + path = File.join(repository.path, ref) + lock_path = "#{path}.lock" + + FileUtils.mkdir_p(File.dirname(path)) + File.open(lock_path, 'w') { |f| f.write('') } + + begin + expect { repository.keep_around(sample_commit.id) }.not_to raise_error(Gitlab::Git::Repository::GitError) + + expect(File.exist?(lock_path)).to be_falsey + ensure + File.delete(path) + end + end end describe '#update_ref' do |