Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-26 12:06:04 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-26 12:06:04 +0300
commit759cd6c2985088d187ed519f2a881c2c690b34ec (patch)
tree183e291c0404bf9b3ac7638be6fa1fe94b7d2d14 /spec/lib/banzai
parent9735395f94088df7e6470e3e8a2638385ede36b6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/banzai')
-rw-r--r--spec/lib/banzai/filter/video_link_filter_spec.rb35
1 files changed, 20 insertions, 15 deletions
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