diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-26 12:06:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-26 12:06:04 +0300 |
commit | 759cd6c2985088d187ed519f2a881c2c690b34ec (patch) | |
tree | 183e291c0404bf9b3ac7638be6fa1fe94b7d2d14 /spec | |
parent | 9735395f94088df7e6470e3e8a2638385ede36b6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
6 files changed, 114 insertions, 20 deletions
diff --git a/spec/features/projects/commits/user_browses_commits_spec.rb b/spec/features/projects/commits/user_browses_commits_spec.rb index 085d8d63d52..131d9097f48 100644 --- a/spec/features/projects/commits/user_browses_commits_spec.rb +++ b/spec/features/projects/commits/user_browses_commits_spec.rb @@ -93,13 +93,13 @@ describe 'User browses commits' do context 'when the blob does not exist' do let(:commit) { create(:commit, project: project) } - it 'shows a blank label' do + it 'renders successfully' do allow_any_instance_of(Gitlab::Diff::File).to receive(:blob).and_return(nil) allow_any_instance_of(Gitlab::Diff::File).to receive(:binary?).and_return(true) visit(project_commit_path(project, commit)) - expect(find('.diff-file-changes', visible: false)).to have_content('No file name available') + expect(find('.diff-file-changes', visible: false)).to have_content('files/ruby/popen.rb') end end diff --git a/spec/fixtures/api/schemas/deployment.json b/spec/fixtures/api/schemas/deployment.json index 81c2d1ef5ab..b1e3c000ddf 100644 --- a/spec/fixtures/api/schemas/deployment.json +++ b/spec/fixtures/api/schemas/deployment.json @@ -60,7 +60,8 @@ "scheduled_actions": { "type": "array", "items": { "$ref": "job/job.json" } - } + }, + "status": { "type": "string" } }, "additionalProperties": false } diff --git a/spec/fixtures/api/schemas/public_api/v4/deployment.json b/spec/fixtures/api/schemas/public_api/v4/deployment.json index 3af2dc27d55..13b10eac625 100644 --- a/spec/fixtures/api/schemas/public_api/v4/deployment.json +++ b/spec/fixtures/api/schemas/public_api/v4/deployment.json @@ -26,7 +26,8 @@ { "type": "null" }, { "$ref": "job.json" } ] - } + }, + "status": { "type": "string" } }, "additionalProperties": false } diff --git a/spec/fixtures/api/schemas/public_api/v4/environment.json b/spec/fixtures/api/schemas/public_api/v4/environment.json index 242e90fb7ac..57352017f03 100644 --- a/spec/fixtures/api/schemas/public_api/v4/environment.json +++ b/spec/fixtures/api/schemas/public_api/v4/environment.json @@ -17,7 +17,8 @@ { "type": "null" }, { "$ref": "deployment.json" } ] - } + }, + "state": { "type": "string" } }, "additionalProperties": false } diff --git a/spec/frontend/jobs/store/utils_spec.js b/spec/frontend/jobs/store/utils_spec.js index 1e885b6b788..bb45fcb7435 100644 --- a/spec/frontend/jobs/store/utils_spec.js +++ b/spec/frontend/jobs/store/utils_spec.js @@ -3,6 +3,7 @@ import { updateIncrementalTrace, parseHeaderLine, parseLine, + findOffsetAndRemove, } from '~/jobs/store/utils'; import { utilsMockData, @@ -83,6 +84,91 @@ describe('Jobs Store Utils', () => { }); }); + describe('findOffsetAndRemove', () => { + describe('when last item is header', () => { + const existingLog = [ + { + isHeader: true, + isClosed: true, + line: { content: [{ text: 'bar' }], offset: 10, lineNumber: 1 }, + }, + ]; + + describe('and matches the offset', () => { + it('returns an array with the item removed', () => { + const newData = [{ offset: 10, content: [{ text: 'foobar' }] }]; + const result = findOffsetAndRemove(newData, existingLog); + + expect(result).toEqual([]); + }); + }); + + describe('and does not match the offset', () => { + it('returns the provided existing log', () => { + const newData = [{ offset: 110, content: [{ text: 'foobar' }] }]; + const result = findOffsetAndRemove(newData, existingLog); + + expect(result).toEqual(existingLog); + }); + }); + }); + + describe('when last item is a regular line', () => { + const existingLog = [{ content: [{ text: 'bar' }], offset: 10, lineNumber: 1 }]; + + describe('and matches the offset', () => { + it('returns an array with the item removed', () => { + const newData = [{ offset: 10, content: [{ text: 'foobar' }] }]; + const result = findOffsetAndRemove(newData, existingLog); + + expect(result).toEqual([]); + }); + }); + + describe('and does not match the fofset', () => { + it('returns the provided old log', () => { + const newData = [{ offset: 101, content: [{ text: 'foobar' }] }]; + const result = findOffsetAndRemove(newData, existingLog); + + expect(result).toEqual(existingLog); + }); + }); + }); + + describe('when last item is nested', () => { + const existingLog = [ + { + isHeader: true, + isClosed: true, + lines: [{ offset: 101, content: [{ text: 'foobar' }], lineNumber: 2 }], + line: { + offset: 10, + lineNumber: 1, + section_duration: '10:00', + }, + }, + ]; + + describe('and matches the offset', () => { + it('returns an array with the last nested line item removed', () => { + const newData = [{ offset: 101, content: [{ text: 'foobar' }] }]; + + const result = findOffsetAndRemove(newData, existingLog); + expect(result[0].lines).toEqual([]); + }); + }); + + describe('and does not match the offset', () => { + it('returns the provided old log', () => { + const newData = [{ offset: 120, content: [{ text: 'foobar' }] }]; + + const result = findOffsetAndRemove(newData, existingLog); + expect(result).toEqual(existingLog); + }); + }); + }); + }); + describe('updateIncrementalTrace', () => { describe('without repeated section', () => { it('concats and parses both arrays', () => { diff --git a/spec/lib/banzai/filter/video_link_filter_spec.rb b/spec/lib/banzai/filter/video_link_filter_spec.rb index b5be204d680..afcc846ba05 100644 --- a/spec/lib/banzai/filter/video_link_filter_spec.rb +++ b/spec/lib/banzai/filter/video_link_filter_spec.rb @@ -17,27 +17,32 @@ describe Banzai::Filter::VideoLinkFilter do let(:project) { create(:project, :repository) } - context 'when the element src has a video extension' do - UploaderHelper::SAFE_VIDEO_EXT.each do |ext| - it "replaces the image tag 'path/video.#{ext}' with a video tag" do - container = filter(link_to_image("/path/video.#{ext}")).children.first + shared_examples 'replaces the image tag with a video tag' do |ext| + it "replaces the image tag 'path/video.#{ext}' with a video tag" do + container = filter(link_to_image("/path/video.#{ext}")).children.first - expect(container.name).to eq 'div' - expect(container['class']).to eq 'video-container' + expect(container.name).to eq 'div' + expect(container['class']).to eq 'video-container' + + video, paragraph = container.children - video, paragraph = container.children + expect(video.name).to eq 'video' + expect(video['src']).to eq "/path/video.#{ext}" - expect(video.name).to eq 'video' - expect(video['src']).to eq "/path/video.#{ext}" + expect(paragraph.name).to eq 'p' - expect(paragraph.name).to eq 'p' + link = paragraph.children.first - link = paragraph.children.first + expect(link.name).to eq 'a' + expect(link['href']).to eq "/path/video.#{ext}" + expect(link['target']).to eq '_blank' + end + end - expect(link.name).to eq 'a' - expect(link['href']).to eq "/path/video.#{ext}" - expect(link['target']).to eq '_blank' - end + context 'when the element src has a video extension' do + UploaderHelper::SAFE_VIDEO_EXT.each do |ext| + it_behaves_like 'replaces the image tag with a video tag', ext + it_behaves_like 'replaces the image tag with a video tag', ext.upcase end end |