Cukes C0 Coverage Information - Simploco - RCov

support/html_formatter.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
support/html_formatter.rb 57 14
85.96%
42.86%

Key

Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.

Coverage Details

2 =begin
3 *Name           : HtmlFormatter
4 *Description    : class that defines wrapper methods for Cucumber generated report
5 *Author         : Chandra sekaran
6 *Creation Date  : 24/04/2015
7 *Updation Date  :
8 =end
9 
10 require 'cucumber/formatter/html'
11 
12 module Formatter
13   class HtmlFormatter < Cucumber::Formatter::Html    # for uaing @builder object
14     
15     # Description      : embeds the given input file type to cucumber report
16     # Author           : Chandra sekaran
17     # Arguments        :
18     #  str_src         : relative path of the file
19     #  str_mime_type   : type of file
20     #  str_label       : link text on click of click of which shows the embedded file
21     #
22     def embed(str_src, str_mime_type, str_label)
23       case str_mime_type
24         when /^image\/(png|gif|jpg|jpeg)/
25           embed_image(str_src, str_label)
26         when /^text\/plain/
27           embed_file(str_src, str_label)
28       end
29     end
30 
31     # Description      : embeds a link with the given input string
32     # Author           : Chandra sekaran
33     # Arguments        :
34     #  str_src         : relative path of the file
35     #  str_label       : link text
36     #
37     def embed_link(str_src, str_label)
38       @builder.span(:class => 'embed') do |pre|
39         pre << %{<a href="#{str_src}" target="_blank">"#{str_label}"</a> }
40       end
41     end
42 
43     # Description      : embeds the given input file type to cucumber report
44     # Author           : Chandra sekaran
45     # Arguments        :
46     #  str_src         : relative path of the file
47     #  str_label       : link text on click of click of which shows the embedded file
48     #
49     def embed_file(str_src, str_label = "Click to view embedded file")
50         id = "object_#{Time.now.strftime("%y%m%d%H%M%S")}"
51         @builder.span(:class => 'embed') do |pre|
52           pre << %{<a href="" onclick="o=document.getElementById('#{id}'); o.style.display = (o.style.display == 'none' ? 'block' : 'none');return false">#{str_label}</a><br>&nbsp;
53 	        <object id="#{id}" data="#{str_src}" type="text/plain" width="100%" style="height: 10em;display: none"></object>}
54         end
55     end
56 
57   end
58 end

Generated on 2015-05-08 10:40:30 +0530 with SimpleCov-RCov 0.2.3