class Rectify::RSpec::DatabaseReporter::QueryInfo

Attributes

example[R]
finish[R]
query[R]
start[R]

Public Class Methods

new(example, start, finish, query) click to toggle source
# File lib/rectify/rspec/database_reporter/query_info.rb, line 5
def initialize(example, start, finish, query)
  @example = example
  @start   = start
  @finish  = finish
  @query   = query
end

Public Instance Methods

ignore?() click to toggle source
# File lib/rectify/rspec/database_reporter/query_info.rb, line 28
def ignore?
  SQL_TO_IGNORE.match(query[:sql]) || example.blank?
end
target() click to toggle source
# File lib/rectify/rspec/database_reporter/query_info.rb, line 12
def target
  return described_class.name if described_class

  root_example_group_description
end
time() click to toggle source
# File lib/rectify/rspec/database_reporter/query_info.rb, line 18
def time
  finish.to_f - start.to_f
end
type() click to toggle source
# File lib/rectify/rspec/database_reporter/query_info.rb, line 22
def type
  return example.metadata[:type] unless described_class

  described_class <= Rectify::Query ? :query : :unit
end

Private Instance Methods

described_class() click to toggle source
# File lib/rectify/rspec/database_reporter/query_info.rb, line 36
def described_class
  example.metadata[:described_class]
end
root_example_group_description() click to toggle source
# File lib/rectify/rspec/database_reporter/query_info.rb, line 40
def root_example_group_description
  example.example_group.parent_groups.last.description
end