2019-09-30 05:06:31 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-06-21 08:22:40 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe BlobEntity do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:blob) { project.commit('master').diffs.diff_files.first.blob }
|
|
|
|
let(:request) { EntityRequest.new(project: project, ref: 'master') }
|
|
|
|
|
|
|
|
let(:entity) do
|
|
|
|
described_class.new(blob, request: request)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'as json' do
|
|
|
|
subject { entity.as_json }
|
|
|
|
|
2019-10-29 08:06:40 -04:00
|
|
|
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",
|
2019-12-18 16:07:37 -05:00
|
|
|
url: "/#{project.full_path}/blob/master/bar/branch-test.txt"
|
2019-10-29 08:06:40 -04:00
|
|
|
})
|
2018-06-21 08:22:40 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|