mirror of
https://github.com/inspec/inspec
synced 2024-11-23 21:23:29 +00:00
Add title, description, code, and source_location to example metadata
This commit is contained in:
parent
53a8f9a7b9
commit
08616f50d0
2 changed files with 10 additions and 0 deletions
|
@ -22,6 +22,8 @@ module RSpec::Core::Formatters
|
|||
pending_message: example.execution_result.pending_message,
|
||||
id: example.metadata[:id],
|
||||
impact: example.metadata[:impact],
|
||||
title: example.metadata[:title],
|
||||
desc: example.metadata[:desc],
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -102,9 +102,17 @@ module Inspec
|
|||
def set_rspec_ids(example, id, rule)
|
||||
example.metadata[:id] = id
|
||||
example.metadata[:impact] = rule.impact
|
||||
example.metadata[:title] = rule.title
|
||||
example.metadata[:desc] = rule.desc
|
||||
example.metadata[:code] = rule.instance_variable_get(:@__code)
|
||||
example.metadata[:source_location] = rule.instance_variable_get(:@__source_location)
|
||||
example.filtered_examples.each do |e|
|
||||
e.metadata[:id] = id
|
||||
e.metadata[:impact] = rule.impact
|
||||
e.metadata[:title] = rule.title
|
||||
e.metadata[:desc] = rule.desc
|
||||
e.metadata[:code] = rule.instance_variable_get(:@__code)
|
||||
e.metadata[:source_location] = rule.instance_variable_get(:@__source_location)
|
||||
end
|
||||
example.children.each do |child|
|
||||
set_rspec_ids(child, id, rule)
|
||||
|
|
Loading…
Reference in a new issue