Sha256: 0075a63cd4a42f60876a5912a5eb74aaaa1399881d38d15313168cd0a7c36dc7

Contents?: true

Size: 977 Bytes

Versions: 75

Compression:

Stored size: 977 Bytes

Contents

# This action tests that embedded Resources have access to the enclosing Provider's
# lexical scope (as demonstrated by the call to new_resource) and that all parameters
# are passed properly (as demonstrated by the call to generate_new_name).
attr_reader :enclosed_resource

def without_deprecation_warnings(&block)
  old_treat_deprecation_warnings_as_errors = Chef::Config[:treat_deprecation_warnings_as_errors]
  Chef::Config[:treat_deprecation_warnings_as_errors] = false
  begin
    block.call
  ensure
    Chef::Config[:treat_deprecation_warnings_as_errors] = old_treat_deprecation_warnings_as_errors
  end
end

action :twiddle_thumbs do
  @enclosed_resource = lwrp_foo :foo do
    monkey generate_new_name(new_resource.monkey){ 'the monkey' }
    # We know there will be a deprecation error here; head it off
    without_deprecation_warnings do
      provider :lwrp_monkey_name_printer
    end
  end
end

def generate_new_name(str, &block)
  "#{str}, #{block.call}"
end

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
chef-12.13.37-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.13.37 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.13.30 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.13.30-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.12.15-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.12.15 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.12.13 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.12.13-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.11.18-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.11.18 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.10.24 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.10.24-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.9.41 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.9.41-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.9.38 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.9.38-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.7.2 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.7.2-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.6.0 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-12.6.0-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb