Class: Multicuke::ReportsIndex
- Inherits:
-
Object
- Object
- Multicuke::ReportsIndex
- Defined in:
- lib/multicuke/reports_index.rb
Overview
Generate the index page reporting on the features and their status. Provides the links to the actual full Cucumber html reports.
Instance Attribute Summary collapse
-
#features_dirs ⇒ Object
readonly
Collection of ran features directories results used for reporting.
-
#index_path ⇒ Object
readonly
Full path for the index html file.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(reports_path, features_dirs) ⇒ ReportsIndex
constructor
A new instance of ReportsIndex.
Constructor Details
#initialize(reports_path, features_dirs) ⇒ ReportsIndex
Returns a new instance of ReportsIndex.
13 14 15 16 |
# File 'lib/multicuke/reports_index.rb', line 13 def initialize(reports_path, features_dirs) @features_dirs = features_dirs @index_path = File.join(reports_path, "index.html") end |
Instance Attribute Details
#features_dirs ⇒ Object (readonly)
Collection of ran features directories results used for reporting
8 9 10 |
# File 'lib/multicuke/reports_index.rb', line 8 def features_dirs @features_dirs end |
#index_path ⇒ Object (readonly)
Full path for the index html file
11 12 13 |
# File 'lib/multicuke/reports_index.rb', line 11 def index_path @index_path end |
Instance Method Details
#generate ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/multicuke/reports_index.rb', line 18 def generate index_file = File.new(index_path, "w") b = Builder::XmlMarkup.new :target => index_file, :indent => 2 b.html { b.head { b.title("Cucumber reports") b.style(css_content) } b.body { b.h2("Features") b.ul { features_dirs.each { |features_dir| b.li(:class => (features_dir.failed? ? "failed" : "success")) { b.a(features_dir.human_name, :href => "#{features_dir.name}.html") b.span("[#{features_dir.duration}]", :class => "duration") b.span("Scenarios: #{features_dir.scenarios_results}, Steps: #{features_dir.steps_results}", :class => "result") } } } } } index_file.close end |