Sha256: 3455402ac1ba6269c725ff51d591b6d5a1000c22b321c17a11c0571205e2a883

Contents?: true

Size: 1.06 KB

Versions: 42

Compression:

Stored size: 1.06 KB

Contents

# encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann

require 'helper'

describe SourceReaders::InspecReader do
  let(:reader) { SourceReaders::InspecReader }

  it 'registers with the source readers registry' do
    reg = Inspec::SourceReader.registry
    _(reg['inspec']).must_equal reader
  end

  describe 'with a valid profile' do
    let(:mock_file) { mock_file = MockLoader.profile_tgz('complete-profile') }
    let(:target) { Inspec::Fetcher.resolve(mock_file) }
    let(:res) { Inspec::SourceReader.resolve(target) }

    it 'resolves the target to inspec' do
      _(res).must_be_kind_of reader
    end

    it 'retrieves metadata' do
      _(res.metadata.params[:name]).must_equal 'complete'
    end

    it 'retrieves all files' do
      _(res.tests.keys).must_equal %w{controls/filesystem_spec.rb}
      _(res.tests.values[0]).must_match /^control 'test01' do$/
    end

    it 'retrieves all libraries' do
      _(res.libraries.keys).must_equal %w{libraries/testlib.rb}
      _(res.libraries.values[0]).must_match /^# Library resource$/
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
inspec-0.30.0 test/unit/source_readers/inspec_test.rb
inspec-0.29.0 test/unit/source_readers/inspec_test.rb
inspec-0.28.1 test/unit/source_readers/inspec_test.rb
inspec-0.28.0 test/unit/source_readers/inspec_test.rb
inspec-0.27.1 test/unit/source_readers/inspec_test.rb
inspec-0.27.0 test/unit/source_readers/inspec_test.rb
inspec-0.26.0 test/unit/source_readers/inspec_test.rb
inspec-0.25.0 test/unit/source_readers/inspec_test.rb
inspec-0.24.0 test/unit/source_readers/inspec_test.rb
inspec-0.23 test/unit/source_readers/inspec_test.rb
inspec-0.22.1 test/unit/source_readers/inspec_test.rb
inspec-0.22.0 test/unit/source_readers/inspec_test.rb
inspec-0.21.6 test/unit/source_readers/inspec_test.rb
inspec-0.21.5 test/unit/source_readers/inspec_test.rb
inspec-0.21.4 test/unit/source_readers/inspec_test.rb
inspec-0.21.3 test/unit/source_readers/inspec_test.rb
inspec-0.21.2 test/unit/source_readers/inspec_test.rb
inspec-0.21.1 test/unit/source_readers/inspec_test.rb
inspec-0.21.0 test/unit/source_readers/inspec_test.rb
inspec-0.20.1 test/unit/source_readers/inspec_test.rb