diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-10-05 22:36:20 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-10-05 22:36:20 +0000 |
commit | caf10464c0e78817c91ff01e3be5f2f9472aba19 (patch) | |
tree | ba7e070f9266532fa9eefacc4712cf8690e30369 /spec/serializers | |
parent | 1bd08177761a6599d2ebfdfb02bcadee574e9c44 (diff) | |
download | gitlab-ce-caf10464c0e78817c91ff01e3be5f2f9472aba19.tar.gz |
Fix LFS uploaded images not being rendered
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/diff_file_entity_spec.rb | 5 | ||||
-rw-r--r-- | spec/serializers/diff_viewer_entity_spec.rb | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/spec/serializers/diff_file_entity_spec.rb b/spec/serializers/diff_file_entity_spec.rb index 3d90ce44dfb..7497b8f27bd 100644 --- a/spec/serializers/diff_file_entity_spec.rb +++ b/spec/serializers/diff_file_entity_spec.rb @@ -26,6 +26,11 @@ describe DiffFileEntity do ) end + it 'includes viewer' do + expect(subject[:viewer].with_indifferent_access) + .to match_schema('entities/diff_viewer') + end + # Converted diff files from GitHub import does not contain blob file # and content sha. context 'when diff file does not have a blob and content sha' do diff --git a/spec/serializers/diff_viewer_entity_spec.rb b/spec/serializers/diff_viewer_entity_spec.rb new file mode 100644 index 00000000000..66ac6ef2adc --- /dev/null +++ b/spec/serializers/diff_viewer_entity_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe DiffViewerEntity do + include RepoHelpers + + let(:project) { create(:project, :repository) } + let(:repository) { project.repository } + let(:commit) { project.commit(sample_commit.id) } + let(:diff_refs) { commit.diff_refs } + let(:diff) { commit.raw_diffs.first } + let(:diff_file) { Gitlab::Diff::File.new(diff, diff_refs: diff_refs, repository: repository) } + let(:viewer) { diff_file.simple_viewer } + + subject { described_class.new(viewer).as_json } + + it 'serializes diff file viewer' do + expect(subject.with_indifferent_access).to match_schema('entities/diff_viewer') + end +end |