Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test when eyaml_gpg is true and eyaml is unspecified #159

Merged
merged 3 commits into from
Oct 13, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions spec/classes/hiera_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,23 @@
expect(eyaml_backend[:extension]).to eq(nil)
end
end
context 'include gpg with eyaml unspecified' do
let(:params) do
{
eyaml_gpg: true,
datadir: '/etc/puppetlabs/code/environments/%{::environment}/hieradata',
backends: %w(yaml)
}
end
it 'include eyaml-gpg backend with eyaml unspecified' do
backends = YAML.load(content)[:backends]
expect(backends).to eq(%w(yaml eyaml))
eyaml_backend = YAML.load(content)[:eyaml]
expect(eyaml_backend[:datadir]).to eq('/etc/puppetlabs/code/environments/%{::environment}/hieradata')
expect(eyaml_backend[:encrypt_method]).to eq('gpg')
expect(eyaml_backend[:gpg_gnupghome]).to eq('/etc/puppet/keys/gpg')
end
end
# rubocop:enable RSpec/MultipleExpectations
context 'bad data' do
let(:params) do
Expand Down Expand Up @@ -353,6 +370,23 @@
expect(eyaml_backend[:extension]).to eq(nil)
end
end
context 'include gpg with eyaml unspecified' do
let(:params) do
{
eyaml_gpg: true,
datadir: '/etc/puppetlabs/code/environments/%{::environment}/hieradata',
backends: %w(yaml)
}
end
it 'include eyaml-gpg backend with eyaml unspecified' do
backends = YAML.load(content)[:backends]
expect(backends).to eq(%w(yaml eyaml))
eyaml_backend = YAML.load(content)[:eyaml]
expect(eyaml_backend[:datadir]).to eq('/etc/puppetlabs/code/environments/%{::environment}/hieradata')
expect(eyaml_backend[:encrypt_method]).to eq('gpg')
expect(eyaml_backend[:gpg_gnupghome]).to eq('/etc/puppet/keys/gpg')
end
end
# rubocop:enable RSpec/MultipleExpectations
context 'bad data' do
let(:params) do
Expand Down