From eb23754ebbfbf2d465cc0f900720704fb3703633 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 17 Apr 2013 00:06:11 +0200 Subject: Move template tests from actionpack to actionview --- .../test/template/output_safety_helper_test.rb | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 actionview/test/template/output_safety_helper_test.rb (limited to 'actionview/test/template/output_safety_helper_test.rb') diff --git a/actionview/test/template/output_safety_helper_test.rb b/actionview/test/template/output_safety_helper_test.rb new file mode 100644 index 0000000000..76c71c9e6d --- /dev/null +++ b/actionview/test/template/output_safety_helper_test.rb @@ -0,0 +1,28 @@ +require 'abstract_unit' + +class OutputSafetyHelperTest < ActionView::TestCase + tests ActionView::Helpers::OutputSafetyHelper + + def setup + @string = "hello" + end + + test "raw returns the safe string" do + result = raw(@string) + assert_equal @string, result + assert result.html_safe? + end + + test "raw handles nil values correctly" do + assert_equal "", raw(nil) + end + + test "safe_join should html_escape any items, including the separator, if they are not html_safe" do + joined = safe_join(["

foo

".html_safe, "

bar

"], "
") + assert_equal "

foo

<br /><p>bar</p>", joined + + joined = safe_join(["

foo

".html_safe, "

bar

".html_safe], "
".html_safe) + assert_equal "

foo


bar

", joined + end + +end \ No newline at end of file -- cgit v1.2.3