Class: Zucchini::Reporter::HTML
- Inherits:
-
Object
- Object
- Zucchini::Reporter::HTML
- Defined in:
- lib/zucchini/reporters/html.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(features, ci) ⇒ HTML
constructor
A new instance of HTML.
- #write(report_path) ⇒ Object
Constructor Details
#initialize(features, ci) ⇒ HTML
Returns a new instance of HTML.
13 14 15 16 17 18 |
# File 'lib/zucchini/reporters/html.rb', line 13 def initialize(features, ci) @features = features @device = features[0].device @time = Time.now.strftime("%T, %e %B %Y") @ci = ci ? 'ci' : '' end |
Class Method Details
Instance Method Details
#write(report_path) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/zucchini/reporters/html.rb', line 20 def write(report_path) template_path = "#{File.dirname(__FILE__)}/html/template.erb.html" gem_assets_dir = "#{File.dirname(__FILE__)}/html" files_path = report_path.chomp(File.extname report_path) + '_files' @assets_path = copy_assets(gem_assets_dir, "#{files_path}/assets", report_path) @features = copy_images(@features, "#{files_path}/images", report_path) File.open(report_path, 'w+') do |f| f.write ERB.new(File.read(template_path)).result(binding) end end |