class RspecProfiling::Example
Constants
- IGNORED_QUERIES_PATTERN
Attributes
counts[R]
example[R]
Public Class Methods
new(example)
click to toggle source
# File lib/rspec_profiling/example.rb, line 21 def initialize(example) @example = example @counts = Hash.new(0) end
Public Instance Methods
description()
click to toggle source
# File lib/rspec_profiling/example.rb, line 34 def description metadata[:full_description] end
exception()
click to toggle source
# File lib/rspec_profiling/example.rb, line 42 def exception execution_result.exception end
file()
click to toggle source
# File lib/rspec_profiling/example.rb, line 26 def file metadata[:file_path] end
line_number()
click to toggle source
# File lib/rspec_profiling/example.rb, line 30 def line_number metadata[:line_number] end
log_query(query, start, finish)
click to toggle source
# File lib/rspec_profiling/example.rb, line 66 def log_query(query, start, finish) unless query[:sql] =~ IGNORED_QUERIES_PATTERN counts[:query_count] += 1 counts[:query_time] += (finish - start) end end
log_request(request, start, finish)
click to toggle source
# File lib/rspec_profiling/example.rb, line 73 def log_request(request, start, finish) counts[:request_count] += 1 counts[:request_time] += request[:view_runtime].to_f end
query_count()
click to toggle source
# File lib/rspec_profiling/example.rb, line 50 def query_count counts[:query_count] end
query_time()
click to toggle source
# File lib/rspec_profiling/example.rb, line 54 def query_time counts[:query_time] end
request_count()
click to toggle source
# File lib/rspec_profiling/example.rb, line 58 def request_count counts[:request_count] end
request_time()
click to toggle source
# File lib/rspec_profiling/example.rb, line 62 def request_time counts[:request_time] end
status()
click to toggle source
# File lib/rspec_profiling/example.rb, line 38 def status execution_result.status end
time()
click to toggle source
# File lib/rspec_profiling/example.rb, line 46 def time execution_result.run_time end
Private Instance Methods
execution_result()
click to toggle source
# File lib/rspec_profiling/example.rb, line 82 def execution_result @execution_result ||= begin result = example.execution_result result = OpenStruct.new(result) if result.is_a?(Hash) result end end
metadata()
click to toggle source
# File lib/rspec_profiling/example.rb, line 90 def metadata example.metadata end