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.
184 185 186 187 188 189 190 191 |
# File 'lib/rails/test_unit/runner.rb', line 184 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
193 194 195 196 197 198 199 200 201 202 |
# File 'lib/rails/test_unit/runner.rb', line 193 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 |