Merge pull request #543 from chef/vj/add-title-desc-code-source-loc-to-metadata

Add title, description, code, and source_location to example metadata
This commit is contained in:
Dominik Richter 2016-03-17 15:32:36 +01:00
commit 424d97c0b6
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)