inspec/test/unit/fetchers/tar_test.rb
2016-02-22 11:24:35 +01:00

35 lines
903 B
Ruby

# encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann
require 'helper'
describe Fetchers::Tar do
let(:fetcher) { Fetchers::Tar }
it 'registers with the fetchers registry' do
reg = Inspec::Fetcher.registry
_(reg['tar']).must_equal fetcher
end
describe 'applied to a zipped archive' do
let(:target) { MockLoader.profile_tgz('complete-profile') }
let(:res) { fetcher.resolve(target) }
it 'must be resolved' do
_(res).must_be_kind_of fetcher
end
it 'must contain all files' do
_(res.files).must_equal ["inspec.yml", "libraries", "libraries/testlib.rb", "controls", "controls/filesystem_spec.rb"]
end
it 'must not read if the file isnt included' do
_(res.read(rand.to_s)).must_be_nil
end
it 'must read the contents of the file' do
_(res.read('inspec.yml')).must_match /^name: complete$/
end
end
end