expose profile context

This commit is contained in:
Christoph Hartmann 2015-10-10 00:30:26 +02:00
parent 462ffc2eff
commit 22c39bdf62
2 changed files with 8 additions and 3 deletions

View file

@ -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. ' \

View file

@ -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