Class: RSpec::Core::SuiteHookContext

Inherits:
Example
  • Object
show all
Defined in:
lib/rspec/core/example.rb

Overview

Provides an execution context for before/after :suite hooks.

Constant Summary

Constants inherited from Example

Example::AllExceptionsExcludingDangerousOnesOnRubiesThatAllowIt

Instance Attribute Summary

Attributes inherited from Example

#clock, #example_group_instance, #exception, #metadata, #reporter

Instance Method Summary collapse

Methods inherited from Example

delegate_to_metadata, #description, #display_exception, #display_exception=, #duplicate_with, #example_group, #execution_result, #fail_with_exception, #file_path, #full_description, #id, #inspect, #inspect_output, #instance_exec, #location, #location_rerun_argument, parse_id, #pending, #rerun_argument, #run, #set_aggregate_failures_exception, #skip, #skip_with_exception, #update_inherited_metadata

Constructor Details

#initialize(hook_description, reporter) ⇒ SuiteHookContext

Returns a new instance of SuiteHookContext



639
640
641
642
643
# File 'lib/rspec/core/example.rb', line 639

def initialize(hook_description, reporter)
  super(AnonymousExampleGroup, hook_description, {})
  @example_group_instance = AnonymousExampleGroup.new
  @reporter = reporter
end

Instance Method Details

#set_exception(exception) ⇒ Object

rubocop:disable Naming/AccessorMethodName



646
647
648
649
# File 'lib/rspec/core/example.rb', line 646

def set_exception(exception)
  reporter.notify_non_example_exception(exception, "An error occurred in #{description}.")
  RSpec.world.wants_to_quit = true
end