Class: AllureRspec::RspecMetadataParser
- Inherits:
-
Object
- Object
- AllureRspec::RspecMetadataParser
- Includes:
- Utils
- Defined in:
- 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
-
#initialize(example, config) ⇒ RspecMetadataParser
constructor
Metadata parser instance.
-
#labels ⇒ Array<Allure::Label>
Get allure labels.
-
#links ⇒ Array<Allure::Link>
Get attachable links.
-
#location ⇒ String
Example location.
-
#status_details ⇒ Allure::StatusDetails
Get status details.
Methods included from Utils
Constructor Details
#initialize(example, config) ⇒ RspecMetadataParser
Metadata parser instance
35 36 37 38 |
# File 'lib/allure_rspec/metadata_parser.rb', line 35 def initialize(example, config) @example = example @config = config end |
Instance Method Details
#labels ⇒ Array<Allure::Label>
Get allure labels
42 43 44 45 46 47 48 49 50 51 52 |
# File '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 |
#links ⇒ Array<Allure::Link>
Get attachable links
56 57 58 |
# File 'lib/allure_rspec/metadata_parser.rb', line 56 def links matching_links(:tms) + matching_links(:issue) end |
#location ⇒ String
Example location
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/allure_rspec/metadata_parser.rb', line 73 def location file = example . .fetch(:shared_group_inclusion_backtrace) .last &.formatted_inclusion_location return example.location unless file file end |
#status_details ⇒ Allure::StatusDetails
Get status details
62 63 64 65 66 67 68 |
# File 'lib/allure_rspec/metadata_parser.rb', line 62 def status_details Allure::StatusDetails.new( flaky: ![:flaky].nil?, muted: ![:muted].nil?, known: ![:known].nil? ) end |