Class: Rails::TestUnit::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/test_unit/runner.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(runnable, file, line_or_range) ⇒ Filter

Returns a new instance of Filter.



183
184
185
186
187
188
189
190
# File 'lib/rails/test_unit/runner.rb', line 183

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) ⇒ Object



192
193
194
195
196
197
198
199
200
201
# File 'lib/rails/test_unit/runner.rb', line 192

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