Sha256: 33cc7db8bc33d49bbd79ebc3e6df4a497c364b809f7ded57715566f0c1a8d445
Contents?: true
Size: 900 Bytes
Versions: 21
Compression:
Stored size: 900 Bytes
Contents
require File.expand_path("../spec_helper", File.dirname(__FILE__)) require 'gettext_i18n_rails/string_interpolate_fix' describe "String#%" do it "is not safe if it was not safe" do result = ("<br/>%{x}" % {:x => 'a'}) result.should == '<br/>a' result.html_safe?.should == false end it "stays safe if it was safe" do result = ("<br/>%{x}".html_safe % {:x => 'a'}) result.should == '<br/>a' result.html_safe?.should == true end it "escapes unsafe added to safe" do result = ("<br/>%{x}".html_safe % {:x => '<br/>'}) result.should == '<br/><br/>' result.html_safe?.should == true end it "does not escape unsafe if it was unsafe" do result = ("<br/>%{x}" % {:x => '<br/>'}) result.should == '<br/><br/>' result.html_safe?.should == false end it "does not break array replacement" do "%ssd" % ['a'].should == "asd" end end
Version data entries
21 entries across 21 versions & 2 rubygems