diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-02 09:08:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-02 09:08:56 +0300 |
commit | 208e2e308c444624e1d864c936ad7fe178ffc7e9 (patch) | |
tree | 3d779cbf4c44a77417cef8f4764adf6e8a7316da /spec | |
parent | 78214bf7421d73e288466100df584d99e91154af (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/diff/file_spec.rb | 16 | ||||
-rw-r--r-- | spec/models/blob_spec.rb | 8 |
2 files changed, 14 insertions, 10 deletions
diff --git a/spec/lib/gitlab/diff/file_spec.rb b/spec/lib/gitlab/diff/file_spec.rb index c468af4db68..4733607ccc0 100644 --- a/spec/lib/gitlab/diff/file_spec.rb +++ b/spec/lib/gitlab/diff/file_spec.rb @@ -169,18 +169,18 @@ describe Gitlab::Diff::File do end end - describe '#old_blob' do - it 'returns blob of commit of base commit' do - old_data = diff_file.old_blob.data + describe '#old_blob and #new_blob' do + it 'returns blob of base commit and the new commit' do + items = [ + [diff_file.new_content_sha, diff_file.new_path], [diff_file.old_content_sha, diff_file.old_path] + ] - expect(old_data).to include('raise "System commands must be given as an array of strings"') - end - end + expect(project.repository).to receive(:blobs_at).with(items, blob_size_limit: 100 * 1024).and_call_original - describe '#new_blob' do - it 'returns blob of new commit' do + old_data = diff_file.old_blob.data data = diff_file.new_blob.data + expect(old_data).to include('raise "System commands must be given as an array of strings"') expect(data).to include('raise RuntimeError, "System commands must be given as an array of strings"') end end diff --git a/spec/models/blob_spec.rb b/spec/models/blob_spec.rb index c7ca0625b77..7099d000d4c 100644 --- a/spec/models/blob_spec.rb +++ b/spec/models/blob_spec.rb @@ -22,6 +22,7 @@ describe Blob do let(:same_project) { Project.find(project.id) } let(:other_project) { create(:project, :repository) } let(:commit_id) { 'e63f41fe459e62e1228fcef60d7189127aeba95a' } + let(:blob_size_limit) { 10 * 1024 * 1024 } it 'does not fetch blobs when none are accessed' do expect(project.repository).not_to receive(:blobs_at) @@ -30,7 +31,9 @@ describe Blob do end it 'fetches all blobs for the same repository when one is accessed' do - expect(project.repository).to receive(:blobs_at).with([[commit_id, 'CHANGELOG'], [commit_id, 'CONTRIBUTING.md']]).once.and_call_original + expect(project.repository).to receive(:blobs_at) + .with([[commit_id, 'CHANGELOG'], [commit_id, 'CONTRIBUTING.md']], blob_size_limit: blob_size_limit) + .once.and_call_original expect(other_project.repository).not_to receive(:blobs_at) changelog = described_class.lazy(project, commit_id, 'CHANGELOG') @@ -53,7 +56,8 @@ describe Blob do readme = described_class.lazy(project, commit_id, 'README.md') - expect(project.repository).to receive(:blobs_at).with([[commit_id, 'README.md']]).once.and_call_original + expect(project.repository).to receive(:blobs_at) + .with([[commit_id, 'README.md']], blob_size_limit: blob_size_limit).once.and_call_original readme.id end |