diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-02-03 21:58:55 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-02-03 22:13:09 +0100 |
commit | e4f0608164b1a25bc3a35a1bd024efe425410758 (patch) | |
tree | 619fe135fc381fe3a33122bad9d6af4efc3f838e /activerecord/lib/active_record/result.rb | |
parent | 6ece7df8d80c6d93db43878fa4c0278a0204072c (diff) | |
download | rails-e4f0608164b1a25bc3a35a1bd024efe425410758.tar.gz rails-e4f0608164b1a25bc3a35a1bd024efe425410758.tar.bz2 rails-e4f0608164b1a25bc3a35a1bd024efe425410758.zip |
Fix line filters running tests from multiple runnables.
`derive_regexp` was written with the assumption that we were run from a
blank slate — that if the filter didn't match we might as well return it
because it was nil.
This isn't the case because minitest calls `run` on every runnable. Which
is any subclass of Minitest::Runnable, such as ActiveSupport::TestCase,
ActionDispatch::IntegrationTest as well as any inheriting from those.
Thus after the first `run` we'd have put in a composite filter in
`options[:filter]` making the next `run` create a linked list when it
failed to match the regexp and put the composite filter as the head.
Every runnable would accumulate more and more of the same filters,
which effectively acted like an expanding whitelist and we ran tests
from other runnables.
Clog the accumulation by returning nil if there's no filter to derive
a regexp from.
Note: we pass a seed in the tests because Minitest shuffles the runnables
to ensure the whitelist is expanded enough that the failure is triggered.
Diffstat (limited to 'activerecord/lib/active_record/result.rb')
0 files changed, 0 insertions, 0 deletions