Allow passing opts to mock Config; and use mock config in one more place in test helper

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2019-01-27 22:36:33 -05:00
parent b057b0dc01
commit 2186179061
2 changed files with 3 additions and 3 deletions

View file

@ -25,8 +25,8 @@ module Inspec
attr_reader :final_options
# This makes it easy to make a config with a mock backend.
def self.mock
Inspec::Config.new({ backend: :mock }, StringIO.new('{}'))
def self.mock(opts = {})
Inspec::Config.new({ backend: :mock }.merge(opts), StringIO.new('{}'))
end
def initialize(cli_opts = {}, cfg_io = nil, command_name = nil)

View file

@ -609,7 +609,7 @@ class MockLoader
def self.load_profile(name, opts = {})
opts[:test_collector] = Inspec::RunnerMock.new
opts[:backend] = Inspec::Backend.create(opts)
opts[:backend] = Inspec::Backend.create(Inspec::Config.mock(opts))
Inspec::Profile.for_target(profile_path(name), opts)
end