diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-09 08:49:27 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-09 08:49:27 +0000 |
commit | 74896c0252bf76c159a40895a5dfe2e75ab112bf (patch) | |
tree | e8685357d4c0ed1970c77ee8f1314c866b391e9b /activesupport/test | |
parent | afbfde9357ab0c6bbaebb62eaa99af8c3825d6ac (diff) | |
download | rails-74896c0252bf76c159a40895a5dfe2e75ab112bf.tar.gz rails-74896c0252bf76c159a40895a5dfe2e75ab112bf.tar.bz2 rails-74896c0252bf76c159a40895a5dfe2e75ab112bf.zip |
Added String#starts_with? and String#ends_with? #2118 [thijs@vandervossen.net]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2171 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 34d4057cf9..c1c1918817 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -81,4 +81,15 @@ class StringInflectionsTest < Test::Unit::TestCase assert_equal "o", s.last assert_equal "llo", s.last(3) end + + def test_starts_ends_with + s = "hello" + assert s.starts_with?('h') + assert s.starts_with?('hel') + assert !s.starts_with?('el') + + assert s.ends_with?('o') + assert s.ends_with?('lo') + assert !s.ends_with?('el') + end end |