Sha256: 4780ca82e6c9ee1af5949e39786a74a73d2453a06434f067930b747ba48996d3

Contents?: true

Size: 846 Bytes

Versions: 1

Compression:

Stored size: 846 Bytes

Contents

module Similatron
  class HtmlReport

    attr_reader :run

    def initialize(run)
      @run = run
      @time = Time.now
    end

    def render
      template_path = File.join(Similatron.lib_path, "assets/report.html.erb")
      template = ERB.new(File.read(template_path))
      template.result(binding)
    end

    def css_styles
      ["normalize.css", "skeleton.css"].map do |file|
        css_path = File.join(Similatron.lib_path, "assets/Skeleton-2.0.4/css", file)
        File.read(css_path)
      end
    end

    def full_path(path)
      File.expand_path(path)
    end

    def run_at
      @time.strftime("%b %d, %Y %H:%M")
    end

    def overwrites?
      !run.overwrite_comparisons.empty?
    end

    def failures?
      !run.failed_comparisons.empty?
    end

    def ok?
      !overwrites? && !failures?
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
similatron-0.2.0 lib/similatron/html_report.rb