aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/string_ext_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext/string_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb23
1 files changed, 23 insertions, 0 deletions
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)