spec/html/escape_spec.rb in escape_utils-0.1.9 vs spec/html/escape_spec.rb in escape_utils-0.2.0

- old
+ new

@@ -31,12 +31,14 @@ it "should escape the & character" do EscapeUtils.escape_html("<b>Bourbon & Branch</b>").should eql("&lt;b&gt;Bourbon &amp; Branch&lt;&#47;b&gt;") end if RUBY_VERSION =~ /^1.9/ - it "should default to utf-8 if Encoding.default_internal is nil" do + it "should default to the original string's encoding if Encoding.default_internal is nil" do Encoding.default_internal = nil - EscapeUtils.escape_html("<b>Bourbon & Branch</b>").encoding.should eql(Encoding.find('utf-8')) + str = "<b>Bourbon & Branch</b>" + str = str.encode('us-ascii') + EscapeUtils.escape_html(str).encoding.should eql(Encoding.find('us-ascii')) end it "should use Encoding.default_internal" do Encoding.default_internal = Encoding.find('utf-8') EscapeUtils.escape_html("<b>Bourbon & Branch</b>").encoding.should eql(Encoding.default_internal) \ No newline at end of file