Class: AllureRspec::RspecMetadataParser

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
allure-rspec/lib/allure_rspec/metadata_parser.rb

Overview

RSpec metadata parser

Constant Summary collapse

RSPEC_IGNORED_METADATA =
%i[
  absolute_file_path
  block
  described_class
  description
  description_args
  example_group
  execution_result
  file_path
  full_description
  last_run_status
  line_number
  location
  rerun_file_path
  retry
  retry_attempts
  retry_exceptions
  scoped_id
  shared_group_inclusion_backtrace
  type
].freeze

Instance Method Summary collapse

Methods included from Utils

#strip_relative

Constructor Details

#initialize(example, config) ⇒ RspecMetadataParser

Metadata parser instance

Parameters:



35
36
37
38
# File 'allure-rspec/lib/allure_rspec/metadata_parser.rb', line 35

def initialize(example, config)
  @example = example
  @config = config
end

Instance Method Details

#labelsArray<Allure::Label>

Get allure labels

Returns:



42
43
44
45
46
47
48
49
50
51
52
# File 'allure-rspec/lib/allure_rspec/metadata_parser.rb', line 42

def labels
  [
    framework_label,
    package_label,
    test_class_label,
    severity,
    *tag_labels,
    *behavior_labels,
    *suite_labels
  ].select(&:value)
end

Get attachable links

Returns:



56
57
58
# File 'allure-rspec/lib/allure_rspec/metadata_parser.rb', line 56

def links
  matching_links(:tms) + matching_links(:issue)
end

#status_detailsAllure::StatusDetails

Get status details



62
63
64
65
66
67
68
# File 'allure-rspec/lib/allure_rspec/metadata_parser.rb', line 62

def status_details
  Allure::StatusDetails.new(
    flaky: ![:flaky].nil?,
    muted: ![:muted].nil?,
    known: ![:known].nil?
  )
end