Class: AirborneReport::RspecHtmlFormatter
- Inherits:
-
RSpec::Core::Formatters::BaseFormatter
- Object
- RSpec::Core::Formatters::BaseFormatter
- AirborneReport::RspecHtmlFormatter
- Defined in:
- lib/airborne_report/rspec_html_formatter.rb
Instance Method Summary collapse
Instance Method Details
#craft_html(report) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/airborne_report/rspec_html_formatter.rb', line 22 def craft_html(report) contents = File.read(File.('../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 |
#start(_notification) ⇒ Object
10 11 12 |
# File 'lib/airborne_report/rspec_html_formatter.rb', line 10 def start(_notification) AirborneReport::JsonFile.save(Report.blank) end |
#stop(notification) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/airborne_report/rspec_html_formatter.rb', line 14 def stop(notification) tests = AirborneReport::JsonFile.tests AirborneReport::JsonFile.destroy report = Report.new(tests, notification).to_hash craft_html(report) end |