Sha256: a3687b1358ecdfa2f13ffd790e4bd365c8e4d056acf659a5ff7435f240af31ef
Contents?: true
Size: 933 Bytes
Versions: 1
Compression:
Stored size: 933 Bytes
Contents
require 'rspec/core/formatters/base_formatter' require 'haml' require 'airborne_report/report' require 'airborne_report/storage/tests' module AirborneReport class RspecHtmlFormatter < RSpec::Core::Formatters::BaseFormatter RSpec::Core::Formatters.register self, :stop def stop(notification) tests = AirborneReport::Storage::Tests.all report = Report.new(tests, notification).to_hash craft_html(report) end 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
airborne_report-0.2.0 | lib/airborne_report/rspec_html_formatter.rb |