Merge pull request #1948 from dmathieu/html_safe_numeric

All numerics should be html_safe
This commit is contained in:
José Valim
2011-07-03 05:18:57 -07:00
2 changed files with 5 additions and 1 deletions

View File

@@ -67,7 +67,7 @@ class Object
end
end
class Fixnum
class Numeric
def html_safe?
true
end

View File

@@ -353,6 +353,10 @@ class OutputSafetyTest < ActiveSupport::TestCase
test "A fixnum is safe by default" do
assert 5.html_safe?
end
test "a float is safe by default" do
assert 5.7.html_safe?
end
test "An object is unsafe by default" do
assert !@object.html_safe?