class Cornucopia::RSpecHelper

Attributes

context_seed_value[RW]
last_reported_example[RW]
seed_value[RW]
suite_seed_value[RW]

Public Class Methods

new() click to toggle source
# File lib/cornucopia/rspec_hooks.rb, line 18
def initialize
  @last_reported_example = nil
end

Public Instance Methods

end_example(example) click to toggle source
# File lib/cornucopia/rspec_hooks.rb, line 22
def end_example(example)
  unless example == last_reported_example
    if (example.exception)
      @last_reported_example = example

      puts("random seed for testing was: #{suite_seed_value}, #{context_seed_value}, #{seed_value}")

      Cornucopia::Util::ReportBuilder.current_report.
          within_section("Test Error: #{example.full_description}") do |report|
        configured_report = Cornucopia::Util::Configuration.report_configuration :rspec

        configured_report.add_report_objects example: example, rspec: RSpec, seeds: self
        configured_report.generate_report(report)
      end
    end
  end
end