aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2013-08-13 12:15:48 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2013-08-13 12:16:25 -0500
commit5da23a3f921f0a4a3139495d2779ab0d3bd4cb5f (patch)
tree4a4f6b44fb99f091418126261b684151d258fa48 /activesupport/test
parentd126a081ed840340dff5c6299d01d42aaaf32608 (diff)
downloadrails-5da23a3f921f0a4a3139495d2779ab0d3bd4cb5f.tar.gz
rails-5da23a3f921f0a4a3139495d2779ab0d3bd4cb5f.tar.bz2
rails-5da23a3f921f0a4a3139495d2779ab0d3bd4cb5f.zip
Add String#remove(pattern) as a short-hand for the common pattern of String#gsub(pattern, '')
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb5
1 files changed, 5 insertions, 0 deletions
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|