class AreWeThereYet::Recorder

Public Class Methods

new(options,where) click to toggle source
# File lib/are_we_there_yet/recorder.rb, line 3
def initialize(options,where)
  @db = AreWeThereYet::Persistence::Connection.create(where)

  AreWeThereYet::Persistence::Schema.create(@db)

  log_run
end

Public Instance Methods

close() click to toggle source
# File lib/are_we_there_yet/recorder.rb, line 19
def close
  @run.finish(@db)
  @db.disconnect
end
example_passed(example) click to toggle source
# File lib/are_we_there_yet/recorder.rb, line 15
def example_passed(example)
  persist_metric(example)
end
example_started(example) click to toggle source
# File lib/are_we_there_yet/recorder.rb, line 11
def example_started(example)
  @start = Time.now
end

Private Instance Methods

get_file_path_from(example) click to toggle source
# File lib/are_we_there_yet/recorder.rb, line 31
def get_file_path_from(example)
  example.location.split(':').first
end
log_run() click to toggle source
# File lib/are_we_there_yet/recorder.rb, line 26
def log_run
  @run = AreWeThereYet::Run.new
  @run.start(@db)
end
persist_metric(example) click to toggle source
# File lib/are_we_there_yet/recorder.rb, line 35
def persist_metric(example)

  metric = AreWeThereYet::Metric.new(
    :execution_time => Time.now - @start,
    :path => get_file_path_from(example),
    :description => example.description,
    :run_id => @run.id
  )

  metric.save(@db)
end