Class: SuiteView
Overview
SuiteView is responsible for providing consumable Ruby Cucumber suite stats
Instance Attribute Summary collapse
-
#exclude_tag ⇒ Object
Returns the value of attribute exclude_tag.
-
#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
Methods included from SuiteRender::Pie
#launch, #render_pie_chart_html
Constructor Details
#initialize(opts) ⇒ SuiteView
Returns a new instance of SuiteView.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/suiteview.rb', line 10 def initialize(opts) self.output = nil self.repo = CQL::Repository.new(opts[:repo]) self. = opts[:include_tags] || "" self. = self..split(',') self.exclude_tag = opts[:exclude_tag] # 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 self end |
Instance Attribute Details
#exclude_tag ⇒ Object
Returns the value of attribute exclude_tag.
8 9 10 |
# File 'lib/suiteview.rb', line 8 def exclude_tag @exclude_tag end |
#include_tags ⇒ Object
Returns the value of attribute include_tags.
8 9 10 |
# File 'lib/suiteview.rb', line 8 def @include_tags end |
#output ⇒ Object
Returns the value of attribute output.
8 9 10 |
# File 'lib/suiteview.rb', line 8 def output @output end |
#render_step ⇒ Object
Returns the value of attribute render_step.
8 9 10 |
# File 'lib/suiteview.rb', line 8 def render_step @render_step end |
#repo ⇒ Object
Returns the value of attribute repo.
8 9 10 |
# File 'lib/suiteview.rb', line 8 def repo @repo end |
Instance Method Details
#outline_tag_count(tag) ⇒ Object
23 24 25 26 |
# File 'lib/suiteview.rb', line 23 def outline_tag_count(tag) self.output = outline_query(tag).map { |item| item['examples'] }.flatten.count self end |
#percentages ⇒ Object
47 48 49 50 51 |
# File 'lib/suiteview.rb', line 47 def percentages suite_stat_dto = SuiteStat.new([%w(tag percent)], 0, {}) self.output = calc_percentage(suite_stat_dto) self end |
#render ⇒ Object
57 58 59 |
# File 'lib/suiteview.rb', line 57 def render self.render_step.render end |
#render_to_file(filename) ⇒ Object
61 62 63 |
# File 'lib/suiteview.rb', line 61 def render_to_file(filename) self.render_step.render_to_file(filename) end |
#scenario_tag_count(tag) ⇒ Object
28 29 30 31 |
# File 'lib/suiteview.rb', line 28 def scenario_tag_count(tag) self.output = scenario_query(tag).map { |item| item['name'] }.count self end |
#to_csv ⇒ Object
53 54 55 |
# File 'lib/suiteview.rb', line 53 def to_csv self.render_step.to_csv end |
#total_tag_count(tag) ⇒ Object
33 34 35 36 |
# File 'lib/suiteview.rb', line 33 def total_tag_count(tag) self.output = scenario_tag_count(tag).render + outline_tag_count(tag).render self end |
#total_tags_count ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/suiteview.rb', line 38 def output = [%w(tag count)] self..each do |tag| output << [tag, total_tag_count(tag).render.to_s] end self.output = output self end |