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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-25 21:09:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-25 21:09:02 +0300
commit951616a26a61e880860ad862c1d45a8e3762b4bc (patch)
treeed6fe722e955aff38e13ca02d2aa7fdd4239c863 /spec/lib/gitlab/git/blob_spec.rb
parente06d0e779673d745972863302858105aad9032e5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/git/blob_spec.rb')
-rw-r--r--spec/lib/gitlab/git/blob_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/blob_spec.rb b/spec/lib/gitlab/git/blob_spec.rb
index 079f01c2c4e..9c2f0e910b1 100644
--- a/spec/lib/gitlab/git/blob_spec.rb
+++ b/spec/lib/gitlab/git/blob_spec.rb
@@ -613,6 +613,40 @@ describe Gitlab::Git::Blob, :seed_helper do
end
end
+ describe '#truncated?' do
+ context 'when blob.size is nil' do
+ let(:nil_size_blob) { Gitlab::Git::Blob.new(name: 'test', data: 'abcd') }
+
+ it 'returns false' do
+ expect(nil_size_blob.truncated?).to be_falsey
+ end
+ end
+
+ context 'when blob.data is missing' do
+ let(:nil_data_blob) { Gitlab::Git::Blob.new(name: 'test', size: 4) }
+
+ it 'returns false' do
+ expect(nil_data_blob.truncated?).to be_falsey
+ end
+ end
+
+ context 'when the blob is truncated' do
+ let(:truncated_blob) { Gitlab::Git::Blob.new(name: 'test', size: 40, data: 'abcd') }
+
+ it 'returns true' do
+ expect(truncated_blob.truncated?).to be_truthy
+ end
+ end
+
+ context 'when the blob is untruncated' do
+ let(:untruncated_blob) { Gitlab::Git::Blob.new(name: 'test', size: 4, data: 'abcd') }
+
+ it 'returns false' do
+ expect(untruncated_blob.truncated?).to be_falsey
+ end
+ end
+ end
+
describe 'metrics' do
it 'defines :gitlab_blob_truncated_true counter' do
expect(described_class).to respond_to(:gitlab_blob_truncated_true)