Class: Rails::Filter

Inherits:
Object show all
Defined in:
railties/lib/rails/test_unit/line_filtering.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(runnable, file, line) ⇒ Filter

Returns a new instance of Filter.


54
55
56
57
# File 'railties/lib/rails/test_unit/line_filtering.rb', line 54

def initialize(runnable, file, line)
  @runnable, @file = runnable, File.expand_path(file)
  @line = line.to_i if line
end

Instance Method Details

#===(method) ⇒ Object


59
60
61
62
63
64
65
66
67
68
# File 'railties/lib/rails/test_unit/line_filtering.rb', line 59

def ===(method)
  return unless @runnable.method_defined?(method)

  if @line
    test_file, test_range = definition_for(@runnable.instance_method(method))
    test_file == @file && test_range.include?(@line)
  else
    @runnable.instance_method(method).source_location.first == @file
  end
end