Class: Polytrix::RSpec::DocumentationFormatter
- Inherits:
-
RSpec::Core::Formatters::BaseFormatter
- Object
- RSpec::Core::Formatters::BaseFormatter
- Polytrix::RSpec::DocumentationFormatter
- Includes:
- Core::FileSystemHelper
- Defined in:
- lib/polytrix/rspec/documentation_formatter.rb
Instance Method Summary collapse
- #dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
- #example_group_finished(example_group) ⇒ Object
-
#initialize(output) ⇒ DocumentationFormatter
constructor
A new instance of DocumentationFormatter.
Methods included from Core::FileSystemHelper
#find_file, #recursive_parent_search
Methods included from StringHelpers
Methods included from StringHelpers::ClassMethods
Constructor Details
#initialize(output) ⇒ DocumentationFormatter
Returns a new instance of DocumentationFormatter.
11 12 13 14 15 16 17 |
# File 'lib/polytrix/rspec/documentation_formatter.rb', line 11 def initialize(output) @templates_dir = 'doc-src' @output_dir = 'docs' @results = Hashie::Mash.new @summary_files = %w(index) super end |
Instance Method Details
#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/polytrix/rspec/documentation_formatter.rb', line 26 def dump_summary(duration, example_count, failure_count, pending_count) all_challenges = examples.map { |e| e.[:polytrix_challenge] } grouped_challenges = all_challenges.compact.group_by(&:name) @summary_files.each do |summary_file| template_file = template_for summary_file, use_default: false next if template_file.nil? target_file = target_file_for_summary(template_file) produce_doc template_file, target_file, 'Summary', grouped_challenges end end |
#example_group_finished(example_group) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/polytrix/rspec/documentation_formatter.rb', line 19 def example_group_finished(example_group) polytrix_challenges = example_group.examples.map { |e| e.[:polytrix_challenge] } target_file = target_file_for example_group template_file = template_for example_group produce_doc template_file, target_file, example_group.description, polytrix_challenges if template_file end |