require "spec_helper"
require "gettext_i18n_rails/string_interpolate_fix"
describe "String#%" do
it "is not safe if it was not safe" do
result = ("
%{x}" % {:x => 'a'})
result.should == '
a'
result.html_safe?.should == false
end
xit "stays safe if it was safe" do
result = ("
%{x}".html_safe % {:x => 'a'})
result.should == '
a'
result.html_safe?.should == true
end
xit "escapes unsafe added to safe" do
result = ("
%{x}".html_safe % {:x => '
'})
result.should == '
<br/>'
result.html_safe?.should == true
end
it "does not escape unsafe if it was unsafe" do
result = ("
%{x}" % {:x => '
'})
result.should == '
'
result.html_safe?.should == false
end
it "does not break array replacement" do
"%ssd" % ['a'].should == "asd"
end
end