Class: Torkify::Event::RanAllTestFilesEvent

Inherits:
Struct
  • Object
show all
Includes:
Message
Defined in:
lib/torkify/event/ran_all_test_files_event.rb

Overview

Event used when all tests have finished running.

The time method gives the approximate time in seconds that the tests took to run.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Message

#message

Constructor Details

#initialize(type, passed = [], failed = []) ⇒ RanAllTestFilesEvent

Returns a new instance of RanAllTestFilesEvent.



12
13
14
15
# File 'lib/torkify/event/ran_all_test_files_event.rb', line 12

def initialize(type, passed = [], failed = [])
  @created = Time.now.to_f
  super
end

Instance Attribute Details

#failedObject

Returns the value of attribute failed

Returns:

  • (Object)

    the current value of failed



9
10
11
# File 'lib/torkify/event/ran_all_test_files_event.rb', line 9

def failed
  @failed
end

#passedObject

Returns the value of attribute passed

Returns:

  • (Object)

    the current value of passed



9
10
11
# File 'lib/torkify/event/ran_all_test_files_event.rb', line 9

def passed
  @passed
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



9
10
11
# File 'lib/torkify/event/ran_all_test_files_event.rb', line 9

def type
  @type
end

Instance Method Details

#stop!Object



17
18
19
20
21
22
# File 'lib/torkify/event/ran_all_test_files_event.rb', line 17

def stop!
  if @time.nil?
    @time = Time.now.to_f - @created
  end
  self
end

#timeObject



24
25
26
27
# File 'lib/torkify/event/ran_all_test_files_event.rb', line 24

def time
  stop!
  @time
end