aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/testing
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-07-22 23:13:42 +0200
committerXavier Noria <fxn@hashref.com>2016-07-22 23:13:49 +0200
commitcfc91c31aa989826e992be29b6d5b181f654f853 (patch)
treeb5ec5569b22f8c796de89335c5ecc7de047130bc /activesupport/lib/active_support/testing
parentaea0e5cd709e0fc53e1ba4e87235b8ee3f4bc155 (diff)
downloadrails-cfc91c31aa989826e992be29b6d5b181f654f853.tar.gz
rails-cfc91c31aa989826e992be29b6d5b181f654f853.tar.bz2
rails-cfc91c31aa989826e992be29b6d5b181f654f853.zip
systematic revision of =~ usage in AS
Where appropriate prefer the more concise Regexp#match?, String#include?, String#start_with?, and String#end_with?
Diffstat (limited to 'activesupport/lib/active_support/testing')
-rw-r--r--activesupport/lib/active_support/testing/deprecation.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/testing/deprecation.rb b/activesupport/lib/active_support/testing/deprecation.rb
index 5dfa14eeba..643b32939d 100644
--- a/activesupport/lib/active_support/testing/deprecation.rb
+++ b/activesupport/lib/active_support/testing/deprecation.rb
@@ -1,4 +1,5 @@
require 'active_support/deprecation'
+require 'active_support/core_ext/regexp'
module ActiveSupport
module Testing
@@ -8,7 +9,7 @@ module ActiveSupport
assert !warnings.empty?, "Expected a deprecation warning within the block but received none"
if match
match = Regexp.new(Regexp.escape(match)) unless match.is_a?(Regexp)
- assert warnings.any? { |w| w =~ match }, "No deprecation warning matched #{match}: #{warnings.join(', ')}"
+ assert warnings.any? { |w| match.match?(w) }, "No deprecation warning matched #{match}: #{warnings.join(', ')}"
end
result
end