diff options
author | Xavier Noria <fxn@hashref.com> | 2010-08-29 23:50:30 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-08-29 23:52:38 +0200 |
commit | 475ea14fd0a84604158ec30d9c718d3c8ae055d6 (patch) | |
tree | 37fa903848fb4eb623aed26a66abbffb1dafb1f4 /activesupport/test/core_ext | |
parent | a302a333f8edc373e299da4c123bafadcc3a1306 (diff) | |
download | rails-475ea14fd0a84604158ec30d9c718d3c8ae055d6.tar.gz rails-475ea14fd0a84604158ec30d9c718d3c8ae055d6.tar.bz2 rails-475ea14fd0a84604158ec30d9c718d3c8ae055d6.zip |
implements String#strip_heredoc
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 23 |
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) |