Class: RSpec::Distrib::ExampleResult Private

Inherits:
Object
  • Object
show all
Extended by:
DelegateToMetadata
Defined in:
lib/rspec/distrib/example_group.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Objects that mimic an RSpec::Core::Example on the Reporters.

This is necessary because the RSpec::Core::Example is quite large and not Marshalable.

So we send this object to the Leader instead of the real Example.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DelegateToMetadata

delegate_to_metadata

Constructor Details

#initialize(example, example_group) ⇒ ExampleResult

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ExampleResult.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/rspec/distrib/example_group.rb', line 93

def initialize(example, example_group)
  (example.)
  @description = example.description
  @location_rerun_argument = example.location_rerun_argument
  @example_group = example_group
  exception_presenter = RSpec::Core::Formatters::ExceptionPresenter::Factory.new(example).build

  if example.exception # rubocop:disable Style/GuardClause
    colorizer = ::RSpec::Core::Notifications::NullColorizer
    # FIXME: figure out how to pass proper failure_number
    @fully_formatted_lines = exception_presenter.fully_formatted_lines(1, colorizer)
    @formatted_backtrace = exception_presenter.formatted_backtrace
  end
end

Instance Attribute Details

#descriptionObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



87
88
89
# File 'lib/rspec/distrib/example_group.rb', line 87

def description
  @description
end

#exampleObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



87
88
89
# File 'lib/rspec/distrib/example_group.rb', line 87

def example
  @example
end

#example_groupObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



87
88
89
# File 'lib/rspec/distrib/example_group.rb', line 87

def example_group
  @example_group
end

#formatted_backtraceObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



87
88
89
# File 'lib/rspec/distrib/example_group.rb', line 87

def formatted_backtrace
  @formatted_backtrace
end

#location_rerun_argumentObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



87
88
89
# File 'lib/rspec/distrib/example_group.rb', line 87

def location_rerun_argument
  @location_rerun_argument
end

#metadataObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



87
88
89
# File 'lib/rspec/distrib/example_group.rb', line 87

def 
  
end

Instance Method Details

#exceptionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



108
109
110
# File 'lib/rspec/distrib/example_group.rb', line 108

def exception
  execution_result.exception
end

#fully_formatted_lines(_failure_number = nil, _colorizer = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



116
117
118
# File 'lib/rspec/distrib/example_group.rb', line 116

def fully_formatted_lines(_failure_number = nil, _colorizer = nil)
  @fully_formatted_lines
end

#idObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



112
113
114
# File 'lib/rspec/distrib/example_group.rb', line 112

def id
  "#{metadata[:rerun_file_path]}[#{metadata[:scoped_id]}]"
end