inspec/lib/fetchers/mock.rb
Steven Danna 6814d6ad2b
Fail if a remote source content doesn't match lockfile
If a URL based source does not match the shasum recorded in the
lockfile, it likely means a new version has been pushed to the remote
source. In this case, we fail to help ensure that when using a lockfile
we always run the same code as when the lockfile was created.

Signed-off-by: Steven Danna <steve@chef.io>
2016-09-21 10:15:52 +01:00

35 lines
514 B
Ruby

# encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann
module Fetchers
class Mock < Inspec.fetcher(1)
name 'mock'
priority 0
def self.resolve(target)
return nil unless target.is_a? Hash
new(target)
end
def initialize(data)
@data = data
end
def fetch(_path)
archive_path
end
def archive_path
{ mock: @data }
end
def resolved_source
{ mock_fetcher: true }
end
def cache_key
''
end
end
end