class RSpec::Core::Example

Example is the class that represents a test case

def assign_generated_description

def assign_generated_description
  metadata[:is_description_generated] = description_generated?
  assign_generated_description_core
end

def description_generated?

def description_generated?
  return metadata[:is_description_generated] unless metadata[:is_description_generated].nil?
  description == location_description
end

def generate_trunk_id

def generate_trunk_id
  return "trunk:#{id}-#{location}" if description_generated?
end

def set_exception(exception)

trunk-ignore(rubocop/Naming/AccessorMethodName,rubocop/Metrics/MethodLength,rubocop/Metrics/AbcSize)
decide if we want to fail the test or not
We need to override this to allow us to capture the exception and then
RSpec uses the existance of an exception to determine if the test failed
def set_exception(exception)
  return set_exception_core(exception) if metadata[:pending]
  return set_exception_core(exception) if trunk_disabled
  return set_exception_core(exception) if metadata[:retry_attempts]&.positive?
  id = generate_trunk_id
  name = full_description
  parent_name = example_group.metadata[:description]
  parent_name = parent_name.empty? ? 'rspec' : parent_name
  file = escape(metadata[:file_path])
  classname = file.sub(%r{\.[^/.]+\Z}, '').gsub('/', '.').gsub(/\A\.+|\.+\Z/, '')
  puts "Test failed, checking if it can be quarantined: `#{location}`".yellow
  if $test_report.is_quarantined(id, name, parent_name, classname, file)
    # monitor the override in the metadata
    metadata[:quarantined_exception] = exception
    puts "Test is quarantined, overriding exception: #{exception}".green
    nil
  else
    puts 'Test is not quarantined, continuing'.red
    set_exception_core(exception)
  end
end