File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
lib/rails/dom/testing/assertions/selector_assertions Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 11class SubstitutionContext
22 def initialize
33 @substitute = '?'
4- @regexes = [ ]
54 end
65
76 def substitute! ( selector , values )
87 while !values . empty? && substitutable? ( values . first ) && selector . index ( @substitute )
9- selector . sub! @substitute , substitution_id_for ( values . shift )
8+ selector . sub! @substitute , matcher_for ( values . shift )
109 end
1110 end
1211
13- def match ( matches , attribute , substitution_id )
14- matches . find_all { |node | node [ attribute ] =~ @regexes [ substitution_id ] }
12+ def match ( matches , attribute , matcher )
13+ matches . find_all { |node | node [ attribute ] =~ Regexp . new ( matcher ) }
1514 end
1615
1716 private
18- def substitution_id_for ( value )
19- if value . is_a? ( Regexp )
20- @regexes << value
21- @regexes . size - 1
22- else
23- value
24- end . inspect # Nokogiri doesn't like arbitrary values without quotes, hence inspect.
17+ def matcher_for ( value )
18+ value . to_s . inspect # Nokogiri doesn't like arbitrary values without quotes, hence inspect.
2519 end
2620
2721 def substitutable? ( value )
You can’t perform that action at this time.
0 commit comments