From 5da23a3f921f0a4a3139495d2779ab0d3bd4cb5f Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 13 Aug 2013 12:15:48 -0500 Subject: Add String#remove(pattern) as a short-hand for the common pattern of String#gsub(pattern, '') --- activesupport/test/core_ext/string_ext_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 12126fb9ef..2537af0394 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -277,6 +277,11 @@ class StringInflectionsTest < ActiveSupport::TestCase def test_truncate_should_not_be_html_safe assert !"Hello World!".truncate(12).html_safe? end + + def test_remove + assert_equal "Summer", "Fast Summer".remove(/Fast /) + assert_equal "Summer", "Fast Summer".remove!(/Fast /) + end def test_constantize run_constantize_tests_on do |string| -- cgit v1.2.3