Class: SuiteView
- Inherits:
-
Object
- Object
- SuiteView
- Defined in:
- lib/suiteview.rb
Overview
SuiteView is responsible for providing consumable Ruby Cucumber suite stats
Instance Attribute Summary collapse
-
#include_tags ⇒ Object
Returns the value of attribute include_tags.
-
#output ⇒ Object
Returns the value of attribute output.
-
#render_step ⇒ Object
Returns the value of attribute render_step.
-
#repo ⇒ Object
Returns the value of attribute repo.
Instance Method Summary collapse
-
#initialize(opts) ⇒ SuiteView
constructor
A new instance of SuiteView.
- #outline_tag_count(tag) ⇒ Object
- #percentages ⇒ Object
- #render ⇒ Object
- #render_to_file(filename) ⇒ Object
- #scenario_tag_count(tag) ⇒ Object
- #to_csv ⇒ Object
- #total_tag_count(tag) ⇒ Object
- #total_tags_count ⇒ Object
Constructor Details
#initialize(opts) ⇒ SuiteView
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/suiteview.rb', line 8 def initialize(opts) self.output = nil self.repo = CQL::Repository.new(opts[:repo]) self. = opts[:include_tags] || "" self. = self..split(',') # Create a SuiteRender object and set it as the last step in the chain self.render_step = SuiteRender.new(self) render_step.next_step = self end |
Instance Attribute Details
#include_tags ⇒ Object
Returns the value of attribute include_tags.
6 7 8 |
# File 'lib/suiteview.rb', line 6 def @include_tags end |
#output ⇒ Object
Returns the value of attribute output.
6 7 8 |
# File 'lib/suiteview.rb', line 6 def output @output end |
#render_step ⇒ Object
Returns the value of attribute render_step.
6 7 8 |
# File 'lib/suiteview.rb', line 6 def render_step @render_step end |
#repo ⇒ Object
Returns the value of attribute repo.
6 7 8 |
# File 'lib/suiteview.rb', line 6 def repo @repo end |
Instance Method Details
#outline_tag_count(tag) ⇒ Object
19 20 21 22 |
# File 'lib/suiteview.rb', line 19 def outline_tag_count(tag) self.output = outline_query(tag).map { |item| item['examples'] }.flatten.count self end |
#percentages ⇒ Object
43 44 45 46 47 |
# File 'lib/suiteview.rb', line 43 def percentages suite_stat_dto = SuiteStat.new([%w(tag percent)], 0, {}) self.output = calc_percentage(suite_stat_dto) self end |
#render ⇒ Object
53 54 55 |
# File 'lib/suiteview.rb', line 53 def render self.render_step.render end |
#render_to_file(filename) ⇒ Object
57 58 59 |
# File 'lib/suiteview.rb', line 57 def render_to_file(filename) self.render_step.render_to_file(filename) end |
#scenario_tag_count(tag) ⇒ Object
24 25 26 27 |
# File 'lib/suiteview.rb', line 24 def scenario_tag_count(tag) self.output = scenario_query(tag).map { |item| item['name'] }.count self end |
#to_csv ⇒ Object
49 50 51 |
# File 'lib/suiteview.rb', line 49 def to_csv self.render_step.to_csv end |
#total_tag_count(tag) ⇒ Object
29 30 31 32 |
# File 'lib/suiteview.rb', line 29 def total_tag_count(tag) self.output = scenario_tag_count(tag).render + outline_tag_count(tag).render self end |
#total_tags_count ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/suiteview.rb', line 34 def output = [%w(tag count)] self..each do |tag| output << [tag, total_tag_count(tag).render.to_s] end self.output = output self end |