diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-29 12:06:40 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-29 12:06:40 +0000 |
commit | d64e3a8b281d355c7d51d04df52fab407b8cc76d (patch) | |
tree | 282d6cc62eacd3fb4a0f6841ae52ae4a709e303f /spec/serializers | |
parent | 833eadad8cac85b99871842854c9a676a607e2da (diff) | |
download | gitlab-ce-d64e3a8b281d355c7d51d04df52fab407b8cc76d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/blob_entity_spec.rb | 12 | ||||
-rw-r--r-- | spec/serializers/diff_file_base_entity_spec.rb | 15 |
2 files changed, 23 insertions, 4 deletions
diff --git a/spec/serializers/blob_entity_spec.rb b/spec/serializers/blob_entity_spec.rb index c0687d0232e..7e3a0a87bd5 100644 --- a/spec/serializers/blob_entity_spec.rb +++ b/spec/serializers/blob_entity_spec.rb @@ -15,8 +15,16 @@ describe BlobEntity do context 'as json' do subject { entity.as_json } - it 'exposes needed attributes' do - expect(subject).to include(:readable_text, :url) + it 'contains needed attributes' do + expect(subject).to include({ + id: blob.id, + path: blob.path, + name: blob.name, + mode: "100644", + readable_text: true, + icon: "file-text-o", + url: "/#{project.full_path}/blob/master/bar/branch-test.txt" + }) end end end diff --git a/spec/serializers/diff_file_base_entity_spec.rb b/spec/serializers/diff_file_base_entity_spec.rb index 68c5c665ed6..80f5bc8f159 100644 --- a/spec/serializers/diff_file_base_entity_spec.rb +++ b/spec/serializers/diff_file_base_entity_spec.rb @@ -5,15 +5,15 @@ require 'spec_helper' describe DiffFileBaseEntity do let(:project) { create(:project, :repository) } let(:repository) { project.repository } + let(:entity) { described_class.new(diff_file, options).as_json } context 'diff for a changed submodule' do let(:commit_sha_with_changed_submodule) do "cfe32cf61b73a0d5e9f13e774abde7ff789b1660" end let(:commit) { project.commit(commit_sha_with_changed_submodule) } - let(:diff_file) { commit.diffs.diff_files.to_a.last } let(:options) { { request: {}, submodule_links: Gitlab::SubmoduleLinks.new(repository) } } - let(:entity) { described_class.new(diff_file, options).as_json } + let(:diff_file) { commit.diffs.diff_files.to_a.last } it do expect(entity[:submodule]).to eq(true) @@ -23,4 +23,15 @@ describe DiffFileBaseEntity do ) end end + + context 'contains raw sizes for the blob' do + let(:commit) { project.commit('png-lfs') } + let(:options) { { request: {} } } + let(:diff_file) { commit.diffs.diff_files.to_a.second } + + it do + expect(entity[:old_size]).to eq(1219696) + expect(entity[:new_size]).to eq(132) + end + end end |