inspec/lib/vulcano/rule.rb
Dominik Richter e9d642fc61 feature: replace vcheck
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-06-07 21:41:54 +02:00

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