class AirborneReport::RspecHtmlFormatter

Public Instance Methods

craft_html(report) click to toggle source
# File lib/airborne_report/rspec_html_formatter.rb, line 17
def craft_html(report)
  contents = File.read(File.expand_path('../view/report.html.haml', __FILE__))
  html = "<style>\n#{File.read(File.expand_path('../view/style.css', __FILE__))}\n</style>\n"
  i = 0
  html += Haml::Engine.new(contents).render(
    Object.new,
    :@tests => report['tests'],
    :@statuses => report['statuses'],
    :@i => i
  )
  File.open('report.html', 'w') do |file|
    file.write(html)
  end
end
stop(notification) click to toggle source
# File lib/airborne_report/rspec_html_formatter.rb, line 10
def stop(notification)
  tests = AirborneReport::Storage::Tests.all

  report = Report.new(tests, notification).to_hash
  craft_html(report)
end