class Formatter::HtmlFormatter

Public Instance Methods

embed(str_src, str_mime_type, str_label) click to toggle source

Description : embeds the given input file type to cucumber report Author : Chandra sekaran Arguments :

str_src         : relative path of the file
str_mime_type   : type of file
str_label       : link text on click of click of which shows the embedded file
# File lib/friendly/cukes/framework/support/html_formatter.rb, line 21
def embed(str_src, str_mime_type, str_label)
  case str_mime_type
    when /^image\/(png|gif|jpg|jpeg)/
      embed_image(str_src, str_label)
    when /^text\/plain/
      embed_file(str_src, str_label)
  end
end
embed_file(str_src, str_label = "Click to view embedded file") click to toggle source

Description : embeds the given input file type to cucumber report Author : Chandra sekaran Arguments :

str_src         : relative path of the file
str_label       : link text on click of click of which shows the embedded file
# File lib/friendly/cukes/framework/support/html_formatter.rb, line 48
def embed_file(str_src, str_label = "Click to view embedded file")
    id = "object_#{Time.now.strftime("%y%m%d%H%M%S")}"
    @builder.span(:class => 'embed') do |pre|
      pre << %{<a href="" onclick="o=document.getElementById('#{id}'); o.style.display = (o.style.display == 'none' ? 'block' : 'none');return false">#{str_label}</a><br>&nbsp;
            <object id="#{id}" data="#{str_src}" type="text/plain" width="100%" style="height: 10em;display: none"></object>}
    end
end