Class: Buildkite::TestCollector::MinitestPlugin::Trace

Inherits:
Trace
  • Object
show all
Defined in:
lib/buildkite/test_collector/minitest_plugin/trace.rb

Constant Summary collapse

RESULT_CODES =
{
  '.' => 'passed',
  'F' => 'failed',
  'E' => 'failed',
  'S' => 'pending',
}
FILE_PATH_REGEX =
/^(.*?\.(rb|feature))/

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Trace

#as_hash

Constructor Details

#initialize(example, history:, tags: nil, trace: nil, location_prefix: nil) ⇒ Trace

Returns a new instance of Trace.



20
21
22
23
24
25
# File 'lib/buildkite/test_collector/minitest_plugin/trace.rb', line 20

def initialize(example, history:, tags: nil, trace: nil, location_prefix: nil)
  @example = example
  @history = history
  @tags = tags
  @location_prefix = location_prefix
end

Instance Attribute Details

#exampleObject

Returns the value of attribute example.



5
6
7
# File 'lib/buildkite/test_collector/minitest_plugin/trace.rb', line 5

def example
  @example
end

#failure_expanded=(value) ⇒ Object

Sets the attribute failure_expanded

Parameters:

  • value

    the value to set the attribute failure_expanded to.



6
7
8
# File 'lib/buildkite/test_collector/minitest_plugin/trace.rb', line 6

def failure_expanded=(value)
  @failure_expanded = value
end

#failure_reason=(value) ⇒ Object

Sets the attribute failure_reason

Parameters:

  • value

    the value to set the attribute failure_reason to.



6
7
8
# File 'lib/buildkite/test_collector/minitest_plugin/trace.rb', line 6

def failure_reason=(value)
  @failure_reason = value
end

#historyObject (readonly)

Returns the value of attribute history.



7
8
9
# File 'lib/buildkite/test_collector/minitest_plugin/trace.rb', line 7

def history
  @history
end

#location_prefixObject (readonly)

Returns the value of attribute location_prefix.



8
9
10
# File 'lib/buildkite/test_collector/minitest_plugin/trace.rb', line 8

def location_prefix
  @location_prefix
end

#tagsObject (readonly)

Returns the value of attribute tags.



9
10
11
# File 'lib/buildkite/test_collector/minitest_plugin/trace.rb', line 9

def tags
  @tags
end

Instance Method Details

#resultObject



27
28
29
# File 'lib/buildkite/test_collector/minitest_plugin/trace.rb', line 27

def result
  RESULT_CODES[example.result_code]
end

#source_locationObject



31
32
33
# File 'lib/buildkite/test_collector/minitest_plugin/trace.rb', line 31

def source_location
  @source_location ||= example.method(example.name).source_location
end