Sha256: 8618956d5d9a984008f4fe0d4b9455a30a4275e7b8449397be7688ebe3364557

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

# optional, this should be the path to where the hiera data config file is in this repo
# You must update this if your actual hiera data lives inside your module.
# I only assume you have a separate repository for hieradata and its include in your .fixtures
hiera_config_file = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures','modules','hieradata', 'hiera.yaml'))

# hiera_config and hiera_data are mutually exclusive contexts.

shared_content :global_hiera_data do
  let(:hiera_data) do
     {
     <% @all_hiera_data.sort.each do |key, value| -%>
  #"<%= key %>" => '',
     <% end %>
     }
  end
end

shared_context :hiera do
    # example only,
    let(:hiera_data) do
        {:some_key => "some_value" }
    end
end

shared_context :linux_hiera do
    # example only,
    let(:hiera_data) do
        {:some_key => "some_value" }
    end
end

# In case you want a more specific set of mocked hiera data for windows
shared_context :windows_hiera do
    # example only,
    let(:hiera_data) do
        {:some_key => "some_value" }
    end
end

# you cannot use this in addition to any of the hiera_data contexts above
shared_context :real_hiera_data do
    let(:hiera_config) do
       hiera_config_file
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-retrospec-0.7.3 lib/retrospec/templates/module_files/spec/shared_contexts.rb