mirror of
https://github.com/inspec/inspec
synced 2024-11-27 15:10:44 +00:00
expose profile context
This commit is contained in:
parent
462ffc2eff
commit
22c39bdf62
2 changed files with 8 additions and 3 deletions
|
@ -8,7 +8,7 @@ require 'vulcano/dsl'
|
|||
|
||||
module Vulcano
|
||||
class ProfileContext
|
||||
attr_reader :rules, :only_ifs
|
||||
attr_reader :rules, :only_ifs, :profile_context
|
||||
def initialize(profile_id, backend, profile_registry: {}, only_ifs: [])
|
||||
if backend.nil?
|
||||
fail 'ProfileContext is initiated with a backend == nil. ' \
|
||||
|
|
|
@ -65,8 +65,12 @@ module Vulcano
|
|||
end
|
||||
end
|
||||
|
||||
def add_content(content, source, line = nil)
|
||||
ctx = Vulcano::ProfileContext.new(@profile_id, @backend)
|
||||
def create_context
|
||||
Vulcano::ProfileContext.new(@profile_id, @backend)
|
||||
end
|
||||
|
||||
def add_content(content, source, line = nil, ctx = nil)
|
||||
ctx = create_context if ctx.nil?
|
||||
|
||||
# evaluate all tests
|
||||
ctx.load(content, source, line || 1)
|
||||
|
@ -92,6 +96,7 @@ module Vulcano
|
|||
@tests.register(example)
|
||||
end
|
||||
end
|
||||
ctx
|
||||
end
|
||||
|
||||
def run
|
||||
|
|
Loading…
Reference in a new issue