@@ -8,6 +8,10 @@ class BaseSpecTag < DocTemplate::Tags::BaseTag
88 def self . clean_tag_with_html_regexp
99 @tag_with_html_regexp = nil
1010 end
11+
12+ def self . clean_tag_with_html_regexp_array
13+ @tag_with_html_regexp_array = nil
14+ end
1115end
1216
1317describe DocTemplate ::Tags ::BaseTag do
@@ -33,10 +37,36 @@ def self.clean_tag_with_html_regexp
3337
3438 context 'when TAG_NAME is not defined' do
3539 before { BaseSpecTag . send :remove_const , :TAG_NAME }
40+ after { BaseSpecTag . const_set ( :TAG_NAME , 'image' ) }
3641
3742 it 'raises an error' do
3843 expect { subject } . to raise_error ( StandardError , 'TAG_NAME is not specified' )
3944 end
4045 end
46+
47+ describe '.tag_with_html_regexp_array' do
48+ before { BaseSpecTag . clean_tag_with_html_regexp_array }
49+
50+ subject { BaseSpecTag . tag_with_html_regexp_array }
51+
52+ let ( :content ) do
53+ <<~HTML
54+ < p style ='padding:0;font-size:11pt;font-family:"Arial";line-height:1.5;text-align:left '> < span style ='
55+ vertical-align:baseline;font-size:11pt;font-family:"Cabin"; '> < span > [i</ span > < span
56+ style ='font-family:"Montserrat" '> mage:OP.PT.L13.014, 50, Esta imagen muestra ruedas de carretas que han sido
57+ enterradas por la tierra movida por el viento durante una tormenta de polvo.] Los Estados Unidos tienen una
58+ historia trágica con sedimentos en movimiento por el viento Durante la década de 1930, gran parte de los
59+ Estados Unidos estaba pasando por una sequía.</ span > </ span > </ p >
60+ HTML
61+ end
62+
63+ subject { BaseSpecTag . tag_with_html_regexp_array ( 1 ) }
64+
65+ it 'returns array of RegExp' do
66+ expect ( subject ) . to all ( be_a ( Regexp ) )
67+ expect ( subject . size ) . to eq 5
68+ expect ( subject . detect { _1 . match ( content ) } ) . not_to be_nil
69+ end
70+ end
4171 end
4272end
0 commit comments