diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-08-09 12:55:53 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-08-09 13:41:20 +0300 |
commit | 029fb98b02f00e55243eaa781dc2849e94f16ae5 (patch) | |
tree | 3c9f4fa4c47f545cdd557828026aeccc06e903a6 /spec/models/repository_spec.rb | |
parent | cb30868924d092d74a36ef8e5d0a5e7e8c09d48c (diff) |
Detect if we didn't create the ref sooner
Diffstat (limited to 'spec/models/repository_spec.rb')
-rw-r--r-- | spec/models/repository_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index cfa77648338..1341f7c294c 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -961,6 +961,27 @@ describe Repository, models: true do end end + context 'when temporary ref failed to be created from other project' do + let(:target_project) { create(:project, :empty_repo) } + + before do + expect(target_project.repository).to receive(:run_git) + end + + it 'raises Rugged::ReferenceError' do + raise_reference_error = raise_error(Rugged::ReferenceError) do |err| + expect(err.cause).to be_nil + end + + expect do + GitOperationService.new(user, target_project.repository) + .with_branch('feature', + start_project: project, + &:itself) + end.to raise_reference_error + end + end + context 'when the update adds more than one commit' do let(:old_rev) { '33f3729a45c02fc67d00adb1b8bca394b0e761d9' } |