mirror of
https://github.com/inspec/inspec
synced 2024-11-15 17:28:02 +00:00
e9d642fc61
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
34 lines
639 B
Ruby
34 lines
639 B
Ruby
# encoding: utf-8
|
|
# copyright: 2015, Dominik Richter
|
|
# license: All rights reserved
|
|
require 'vulcano/base_rule'
|
|
|
|
class VulcanoRule < VulcanoBaseRule
|
|
include Serverspec::Helper::Type
|
|
extend Serverspec::Helper::Type
|
|
include RSpec::Core::DSL
|
|
|
|
def describe(sth, &block)
|
|
r = VulcanoRule.describe(sth, &block)
|
|
set_rspec_ids(r)
|
|
end
|
|
|
|
def method_missing(m, *a, &b)
|
|
VulcanoRule.__send__(m, *a, &b)
|
|
end
|
|
|
|
private
|
|
|
|
def set_rspec_ids(obj)
|
|
obj.examples.each {|ex|
|
|
ex.metadata[:id] = @id
|
|
}
|
|
obj.children.each {|c|
|
|
set_rspec_ids(c)
|
|
}
|
|
end
|
|
end
|
|
|
|
def rule id, &block
|
|
VulcanoRule.new(id, &block)
|
|
end
|