summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/git/blob_spec.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-09-21 07:22:12 -0400
committerStan Hu <stanhu@gmail.com>2017-09-21 14:49:51 -0400
commit794b4c5579075ec5361b4ab864052d0717b29492 (patch)
tree8d1c91119835e37bcc077856ce6b30e8c6cbe0a8 /spec/lib/gitlab/git/blob_spec.rb
parentcfccb2785fb8b98a013170aae4b931e9431739d1 (diff)
downloadgitlab-ce-794b4c5579075ec5361b4ab864052d0717b29492.tar.gz
Ensure that Blob.raw returns always returns a valid blob objectsh-blob-raw-check
In gitlab-org/gitlab-ee!2976, we saw that a given OID could point to a commit, which would cause the delta size check to fail. Gitaly already returns nil if the OID isn't a blob, so this change makes the Rugged implementation consistent.
Diffstat (limited to 'spec/lib/gitlab/git/blob_spec.rb')
-rw-r--r--spec/lib/gitlab/git/blob_spec.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/blob_spec.rb b/spec/lib/gitlab/git/blob_spec.rb
index 66ba00acb7d..f3945e748ab 100644
--- a/spec/lib/gitlab/git/blob_spec.rb
+++ b/spec/lib/gitlab/git/blob_spec.rb
@@ -119,10 +119,13 @@ describe Gitlab::Git::Blob, seed_helper: true do
shared_examples 'finding blobs by ID' do
let(:raw_blob) { Gitlab::Git::Blob.raw(repository, SeedRepo::RubyBlob::ID) }
+ let(:bad_blob) { Gitlab::Git::Blob.raw(repository, SeedRepo::BigCommit::ID) }
+
it { expect(raw_blob.id).to eq(SeedRepo::RubyBlob::ID) }
it { expect(raw_blob.data[0..10]).to eq("require \'fi") }
it { expect(raw_blob.size).to eq(669) }
it { expect(raw_blob.truncated?).to be_falsey }
+ it { expect(bad_blob).to be_nil }
context 'large file' do
it 'limits the size of a large file' do