File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,11 @@ class MetaTag < Liquid::Tag
77
88 def render ( context )
99 @context = context
10- attrs = attributes . map { |k , v | %(#{ k } =#{ v . encode ( :xml => :attr ) } ) } . join ( " " )
11- "<link #{ attrs } />"
10+ attrs = attributes . map do |k , v |
11+ v = v . to_s unless v . respond_to? ( :encode )
12+ %(#{ k } =#{ v . encode ( :xml => :attr ) } )
13+ end
14+ "<link #{ attrs . join ( " " ) } />"
1215 end
1316
1417 private
Original file line number Diff line number Diff line change 189189 end
190190 end
191191
192+ context "with site.title set as a non-string value" do
193+ class MySiteTitle
194+ def to_s
195+ "My Dynamic Site Title <&>"
196+ end
197+ alias_method :to_liquid , :to_s
198+ end
199+ let ( :site_title ) { MySiteTitle . new }
200+ let ( :overrides ) { { "title" => site_title } }
201+
202+ it "ensures the site.title is the string representation of the object" do
203+ expect ( feed . title . content ) . to eql ( site_title . to_s . encode ( xml : :text ) )
204+ end
205+ end
206+
192207 context "with site.name set" do
193208 let ( :site_name ) { "My Site Name" }
194209 let ( :overrides ) { { "name" => site_name } }
You can’t perform that action at this time.
0 commit comments