Class: RspecProfiling::Run

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

Instance Method Summary collapse

Constructor Details

#initialize(collector) ⇒ Run

Returns a new instance of Run.



6
7
8
# File 'lib/rspec_profiling/run.rb', line 6

def initialize(collector)
  @collector = collector
end

Instance Method Details

#example_finished(*args) ⇒ Object Also known as: example_passed, example_failed



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rspec_profiling/run.rb', line 20

def example_finished(*args)
  collector.insert({
    commit_sha:    CurrentCommit.sha,
    commit_date:   CurrentCommit.time,
    file:          @current_example.file,
    line_number:   @current_example.line_number,
    description:   @current_example.description,
    status:        @current_example.status,
    time:          @current_example.time,
    query_count:   @current_example.query_count,
    query_time:    @current_example.query_time,
    request_count: @current_example.request_count,
    request_time:  @current_example.request_time
  })
end

#example_started(example) ⇒ Object



15
16
17
18
# File 'lib/rspec_profiling/run.rb', line 15

def example_started(example)
  example = example.example if example.respond_to?(:example)
  @current_example = Example.new(example)
end

#start(*args) ⇒ Object



10
11
12
13
# File 'lib/rspec_profiling/run.rb', line 10

def start(*args)
  start_counting_queries
  start_counting_requests
end