inspec/test/unit/mock/profiles/dependencies/resource-namespace/controls/example.rb
Steven Danna b2146d8758 Allow users to reference resources from dependencies
All resources from deps are added into the control_eval_context used by
the current profile. However, if there is a name conflict, the last
loaded resource wins. The new `require_resource` dsl method allows the
user to do the following:

    require_resource(profile: 'profile_name',
                     resource: 'other',
                    as: 'renamed')

    describe renamed do
      ...
    end

Signed-off-by: Steven Danna <steve@chef.io>
2016-09-19 19:08:43 +02:00

27 lines
593 B
Ruby

# encoding: utf-8
# copyright: 2015, The Authors
# license: All rights reserved
require_resource(profile: 'profile_c', resource: 'gordon_config', as: 'gordy_config')
describe gordy_config do
its('version') { should eq('1.0') }
end
control 'whichgordon' do
describe gordy_config do
its('version') { should eq('1.0') }
end
describe gordon_config do
its('version') { should eq('2.0') }
end
describe gordy_config do
its('version') { should eq(gordy_config.version) }
end
describe gordon_config do
its('version') { should eq(gordon_config.version) }
end
end