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:
Diffstat (limited to 'spec/models/repository_spec.rb')
-rw-r--r--spec/models/repository_spec.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 3a4293836d0..af7457c78e2 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -3832,9 +3832,24 @@ RSpec.describe Repository, feature_category: :source_code_management do
end
end
+ context 'when one of the param is nonexistant' do
+ it 'returns nil' do
+ expect(repository.get_patch_id('HEAD', "f" * 40)).to be_nil
+ end
+ end
+
context 'when two revisions are the same' do
- it 'raises an Gitlab::Git::CommandError error' do
- expect { repository.get_patch_id('HEAD', 'HEAD') }.to raise_error(Gitlab::Git::CommandError)
+ it 'returns nil' do
+ expect(repository.get_patch_id('HEAD', 'HEAD')).to be_nil
+ end
+ end
+
+ context 'when a Gitlab::Git::CommandError is raised' do
+ it 'returns nil' do
+ expect(repository.raw_repository)
+ .to receive(:get_patch_id).and_raise(Gitlab::Git::CommandError)
+
+ expect(repository.get_patch_id('HEAD', "f" * 40)).to be_nil
end
end
end