Add title, description, code, and source_location to example metadata

This commit is contained in:
Victoria Jeffrey 2016-03-16 13:54:20 -04:00 committed by Dominik Richter
parent 53a8f9a7b9
commit 08616f50d0
2 changed files with 10 additions and 0 deletions

View file

@ -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

View file

@ -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)