aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2011-06-10 11:19:26 +0100
committerAndrew White <andyw@pixeltrix.co.uk>2011-06-10 11:32:28 +0100
commit0bcbcdfdad1e082ba7740a5d60c61eb3349b670a (patch)
tree9a3dc8cc645c6700493b1313f6d09a3307d2884c /actionpack/test
parent90c4885766d08bc8779d325df1fff4c8ffc85f3c (diff)
downloadrails-0bcbcdfdad1e082ba7740a5d60c61eb3349b670a.tar.gz
rails-0bcbcdfdad1e082ba7740a5d60c61eb3349b670a.tar.bz2
rails-0bcbcdfdad1e082ba7740a5d60c61eb3349b670a.zip
Ensure number helpers can handle HTML safe strings - closes #1597.
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/number_helper_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/template/number_helper_test.rb b/actionpack/test/template/number_helper_test.rb
index 0104c20bc7..0e3475d98b 100644
--- a/actionpack/test/template/number_helper_test.rb
+++ b/actionpack/test/template/number_helper_test.rb
@@ -283,33 +283,40 @@ class NumberHelperTest < ActionView::TestCase
assert number_to_human(1).html_safe?
assert !number_to_human("<script></script>").html_safe?
assert number_to_human("asdf".html_safe).html_safe?
+ assert number_to_human("1".html_safe).html_safe?
assert number_to_human_size(1).html_safe?
assert number_to_human_size(1000000).html_safe?
assert !number_to_human_size("<script></script>").html_safe?
assert number_to_human_size("asdf".html_safe).html_safe?
+ assert number_to_human_size("1".html_safe).html_safe?
assert number_with_precision(1, :strip_insignificant_zeros => false).html_safe?
assert number_with_precision(1, :strip_insignificant_zeros => true).html_safe?
assert !number_with_precision("<script></script>").html_safe?
assert number_with_precision("asdf".html_safe).html_safe?
+ assert number_with_precision("1".html_safe).html_safe?
assert number_to_currency(1).html_safe?
assert !number_to_currency("<script></script>").html_safe?
assert number_to_currency("asdf".html_safe).html_safe?
+ assert number_to_currency("1".html_safe).html_safe?
assert number_to_percentage(1).html_safe?
assert !number_to_percentage("<script></script>").html_safe?
assert number_to_percentage("asdf".html_safe).html_safe?
+ assert number_to_percentage("1".html_safe).html_safe?
assert number_to_phone(1).html_safe?
assert_equal "&lt;script&gt;&lt;/script&gt;", number_to_phone("<script></script>")
assert number_to_phone("<script></script>").html_safe?
assert number_to_phone("asdf".html_safe).html_safe?
+ assert number_to_phone("1".html_safe).html_safe?
assert number_with_delimiter(1).html_safe?
assert !number_with_delimiter("<script></script>").html_safe?
assert number_with_delimiter("asdf".html_safe).html_safe?
+ assert number_with_delimiter("1".html_safe).html_safe?
end
def test_number_helpers_should_raise_error_if_invalid_when_specified