From 475ea14fd0a84604158ec30d9c718d3c8ae055d6 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sun, 29 Aug 2010 23:50:30 +0200 Subject: implements String#strip_heredoc --- activesupport/test/core_ext/string_ext_test.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index f7e2ecd357..d64706ee10 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -6,10 +6,33 @@ require 'inflector_test_cases' require 'active_support/core_ext/string' require 'active_support/time' require 'active_support/core_ext/kernel/reporting' +require 'active_support/core_ext/string/strip' class StringInflectionsTest < Test::Unit::TestCase include InflectorTestCases + def test_strip_heredoc_on_an_empty_string + assert_equal '', ''.strip_heredoc + end + + def test_strip_heredoc_on_a_string_with_no_lines + assert_equal 'x', 'x'.strip_heredoc + assert_equal 'x', ' x'.strip_heredoc + end + + def test_strip_heredoc_on_a_heredoc_with_no_margin + assert_equal "foo\nbar", "foo\nbar".strip_heredoc + assert_equal "foo\n bar", "foo\n bar".strip_heredoc + end + + def test_strip_heredoc_on_a_regular_indented_heredoc + assert_equal "foo\n bar\nbaz\n", <<-EOS.strip_heredoc + foo + bar + baz + EOS + end + def test_pluralize SingularToPlural.each do |singular, plural| assert_equal(plural, singular.pluralize) -- cgit v1.2.3