aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-01-09 17:24:34 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-01-09 17:24:34 +0100
commit2ac430f4f9778d01f5067f523578d7a6744ab220 (patch)
tree3cdc5348d7771fba3fb6132242ecb037401ea9db
parent69e5547162af5ce9537230239b66a6887699e7c1 (diff)
downloadrails-2ac430f4f9778d01f5067f523578d7a6744ab220.tar.gz
rails-2ac430f4f9778d01f5067f523578d7a6744ab220.tar.bz2
rails-2ac430f4f9778d01f5067f523578d7a6744ab220.zip
[ci skip] Clarify some Minitest origins.
It might be tough for readers to know why we implement `===`, and where the Regexp in `derive_regexp` came from.
-rw-r--r--railties/lib/rails/test_unit/line_filtering.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/railties/lib/rails/test_unit/line_filtering.rb b/railties/lib/rails/test_unit/line_filtering.rb
index 65f76f21a6..fb5ff231e4 100644
--- a/railties/lib/rails/test_unit/line_filtering.rb
+++ b/railties/lib/rails/test_unit/line_filtering.rb
@@ -18,12 +18,14 @@ module Rails
@filters = [ derive_regexp(filter), *derive_line_filters(patterns) ].compact
end
+ # Minitest uses === to find matching filters.
def ===(method)
@filters.any? { |filter| filter === method }
end
private
def derive_regexp(filter)
+ # Regexp filtering copied from Minitest.
filter =~ %r%/(.*)/% ? Regexp.new($1) : filter
end