Sha256: 6931365253e49dd88d4ac5e3b8a1d77b9f6c9c524222c5552a7c2c033f348bbd

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

require ::File.expand_path("../cornucopia", File.dirname(__FILE__))
load ::File.expand_path("capybara/install_finder_extensions.rb", File.dirname(__FILE__))
load ::File.expand_path("capybara/install_matcher_extensions.rb", File.dirname(__FILE__))
load ::File.expand_path("site_prism/install_element_extensions.rb", File.dirname(__FILE__))

RSpec.configure do |config|
  config.before(:suite) do |*args|
    Cornucopia::Util::ReportBuilder.new_report("rspec_report")
  end

  config.after(:suite) do
    Cornucopia::Util::ReportBuilder.current_report.close
  end

  config.around(:each) do |example|
    @seed_value = Cornucopia::Util::Configuration.seed ||
        100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)

    srand(@seed_value)

    example.run

    test_example = example.example if example.respond_to?(:example)
    test_example ||= self.example if self.respond_to?(:example)
    if (test_example.exception)
      puts ("random seed for testing was: #{@seed_value}")

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

        configured_report.add_report_objects example: test_example
        configured_report.generate_report(report)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cornucopia-0.1.13 lib/cornucopia/rspec_hooks.rb
cornucopia-0.1.12 lib/cornucopia/rspec_hooks.rb