Class: RSpec::SuperProfile

Inherits:
Core::Formatters::ProgressFormatter
  • Object
show all
Defined in:
lib/rspec/super_profile.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ SuperProfile

Returns a new instance of SuperProfile.



7
8
9
10
# File 'lib/rspec/super_profile.rb', line 7

def initialize(*args)
  super
  @example_times = []
end

Instance Method Details

#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object

improve upon this.…



42
43
44
45
46
47
48
# File 'lib/rspec/super_profile.rb', line 42

def dump_summary(duration, example_count, failure_count, pending_count)
  super(duration, example_count, failure_count, pending_count)
  
  dump_example_times
  dump_file_times
  @output.flush
end

#example_failed(example) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'lib/rspec/super_profile.rb', line 31

def example_failed(example)
  super
  @example_times << [
    false,
    example_loc(example),
    example.description,
    Time.now - @time
  ]
end

#example_passed(example) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/rspec/super_profile.rb', line 21

def example_passed(example)
  super
  @example_times << [
    true,
    example_loc(example),
    example.description,
    Time.now - @time
  ]
end

#example_started(*args) ⇒ Object



17
18
19
# File 'lib/rspec/super_profile.rb', line 17

def example_started(*args)
  @time = Time.now
end

#start(*args) ⇒ Object



12
13
14
15
# File 'lib/rspec/super_profile.rb', line 12

def start(*args)
  top = (SHOW_TOP==-1 ? 'all' : "top #{SHOW_TOP}")
  @output.puts "Super Profiling enabled: top #{top} tests > #{SHOW_ABOVE} seconds."
end