Class: Polytrix::RSpec::YAMLReport

Inherits:
RSpec::Core::Formatters::BaseFormatter
  • Object
show all
Defined in:
lib/polytrix/rspec/yaml_report.rb

Instance Method Summary collapse

Instance Method Details

#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/polytrix/rspec/yaml_report.rb', line 21

def dump_summary(duration, example_count, failure_count, pending_count)
  results = Hashie::Mash.new(Polytrix.manifest.dup.to_hash)
  all_challenges = examples.map { |e| e.[:polytrix_challenge] }
  grouped_challenges = all_challenges.compact.group_by(&:name)
  results.suites.each do |suite_name, suite|
    suite.samples = suite.samples.each_with_object({}) do |sample_name, sample_results|
      sample_results[sample_name] ||= {}
      if grouped_challenges[sample_name]
        challenge_results = grouped_challenges[sample_name]
        challenge_results.each do |challenge|
          sample_results[sample_name][challenge.implementor.name] = challenge.result
        end
      end
    end
  end
  @output.puts YAML.dump(results.to_hash)
end

#example_failed(example) ⇒ Object



13
14
15
# File 'lib/polytrix/rspec/yaml_report.rb', line 13

def example_failed(example)
  add_implementation_result example, :failed
end

#example_passed(example) ⇒ Object



9
10
11
# File 'lib/polytrix/rspec/yaml_report.rb', line 9

def example_passed(example)
  add_implementation_result example, :passed
end

#example_pending(example) ⇒ Object



17
18
19
# File 'lib/polytrix/rspec/yaml_report.rb', line 17

def example_pending(example)
  add_implementation_result example, :pending
end