If there is no data, alwaya return an empty hash.

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2019-10-08 00:31:23 -07:00
parent 56c2416c57
commit 7516f959d1
2 changed files with 4 additions and 2 deletions

View file

@ -263,7 +263,7 @@ module Inspec::Formatters
# Waiver data, if available, is internally stored on a per-result
# (that is, per-describe-block) basis, because that is the only granularity
# available to us in the RSpec report data structure which we use as a vehicle.
control[:waiver_data] = example.delete(:waiver_data)
control[:waiver_data] ||= example[:waiver_data] || {}
end
end
end

View file

@ -47,7 +47,9 @@ describe "waivers" do
end
def refute_waiver_annotation(control_id)
assert_nil waiver_data control_id
act = waiver_data control_id
assert_instance_of Hash, act
assert_empty act
end
def assert_skip_message(yea, nay)