Class: Rails::TestUnit::Filter
- Inherits:
-
Object
- Object
- Rails::TestUnit::Filter
- Defined in:
- lib/rails/test_unit/runner.rb
Overview
:nodoc:
Instance Method Summary collapse
- #===(method) ⇒ Object
-
#initialize(runnable, file, line_or_range) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(runnable, file, line_or_range) ⇒ Filter
Returns a new instance of Filter.
159 160 161 162 163 164 165 166 |
# File 'lib/rails/test_unit/runner.rb', line 159 def initialize(runnable, file, line_or_range) @runnable, @file = runnable, File.(file) if line_or_range first, last = line_or_range.split("-").map(&:to_i) last ||= first @line_range = Range.new(first, last) end end |
Instance Method Details
#===(method) ⇒ Object
168 169 170 171 172 173 174 175 176 177 |
# File 'lib/rails/test_unit/runner.rb', line 168 def ===(method) return unless @runnable.method_defined?(method) if @line_range test_file, test_range = definition_for(@runnable.instance_method(method)) test_file == @file && @line_range.overlaps?(test_range) else @runnable.instance_method(method).source_location.first == @file end end |