Class: Minitest::Perf::Run

Inherits:
Object
  • Object
show all
Defined in:
lib/minitest/perf/run.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(started_at = Time.now) ⇒ Run

Returns a new instance of Run.



6
7
8
9
# File 'lib/minitest/perf/run.rb', line 6

def initialize(started_at = Time.now)
  @tests       = []
  @started_at  = started_at
end

Instance Attribute Details

#testsObject (readonly)

Returns the value of attribute tests.



4
5
6
# File 'lib/minitest/perf/run.rb', line 4

def tests
  @tests
end

Instance Method Details

#add_test(test) ⇒ Object



23
24
25
# File 'lib/minitest/perf/run.rb', line 23

def add_test(test)
  @tests << test
end

#finish(suite, name, now = Time.now) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/minitest/perf/run.rb', line 15

def finish(suite, name, now = Time.now)
  test_total  = now - @test_start

  add_test Test.new(
    @started_at, suite, name, test_total
  ).tap(&:persist)
end

#start(suite, name, now = Time.now) ⇒ Object



11
12
13
# File 'lib/minitest/perf/run.rb', line 11

def start(suite, name, now = Time.now)
  @test_start = now
end