From 3d90733e937d11b6905ff11ce006a591ec11b4f4 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 15 Dec 2007 02:27:11 +0000 Subject: Ruby 1.9 compat: prefer builtin String#starts_ and ends_with? if available [chuyeow] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8397 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/test/core_ext/string_ext_test.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'activesupport/test/core_ext/string_ext_test.rb') diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 722bb24a37..cec6772272 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -143,15 +143,23 @@ class StringInflectionsTest < Test::Unit::TestCase assert_equal %w(hello), hash.keys end - def test_starts_ends_with + def test_starts_ends_with_alias s = "hello" assert s.starts_with?('h') assert s.starts_with?('hel') assert !s.starts_with?('el') + assert s.start_with?('h') + assert s.start_with?('hel') + assert !s.start_with?('el') + assert s.ends_with?('o') assert s.ends_with?('lo') assert !s.ends_with?('el') + + assert s.end_with?('o') + assert s.end_with?('lo') + assert !s.end_with?('el') end # FIXME: Ruby 1.9 -- cgit v1.2.3