123456789_123456789_123456789_123456789_123456789_

Class: Rails::TestUnit::Filter

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: railties/lib/rails/test_unit/runner.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(runnable, file, line_or_range) ⇒ Filter

[ GitHub ]

  
# File 'railties/lib/rails/test_unit/runner.rb', line 184

def initialize(runnable, file, line_or_range)
  @runnable, @file = runnable, File.expand_path(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)

[ GitHub ]

  
# File 'railties/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

#definition_for(method) (private)

[ GitHub ]

  
# File 'railties/lib/rails/test_unit/runner.rb', line 205

def definition_for(method)
  TestParser.definition_for(method)
end