c14dbaccb1
This change refactors how the dependent libraries are loaded during unit tests, and load the libraries in the base spec_helper to avoid duplicate and redundant implementations. Change-Id: I2b766959dd8ce8cb59f50226f52839ec786f33f9
44 lines
1.3 KiB
Ruby
44 lines
1.3 KiB
Ruby
require 'spec_helper'
|
|
|
|
provider_class = Puppet::Type.type(:neutron_plugin_nuage).provider(:ini_setting)
|
|
describe provider_class do
|
|
let(:resource ) do
|
|
Puppet::Type::Neutron_plugin_nuage.new({
|
|
:name => 'DEFAULT/foo',
|
|
:value => 'bar',
|
|
})
|
|
end
|
|
|
|
let (:provider) { resource.provider }
|
|
|
|
[ 'RedHat', 'Debian' ].each do |os|
|
|
context "on #{os} with default setting" do
|
|
it 'it should fall back to default and use plugin.ini' do
|
|
Facter.fact(:operatingsystem).stubs(:value).returns("#{os}")
|
|
expect(provider.section).to eq('DEFAULT')
|
|
expect(provider.setting).to eq('foo')
|
|
expect(provider.file_path).to eq('/etc/neutron/plugins/nuage/plugin.ini')
|
|
end
|
|
end
|
|
end
|
|
|
|
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
|
|
resource = Puppet::Type::Neutron_plugin_nuage.new(
|
|
{:name => 'somename/foo', :value => '<SERVICE DEFAULT>'}
|
|
)
|
|
provider = provider_class.new(resource)
|
|
provider.exists?
|
|
expect(resource[:ensure]).to eq :absent
|
|
end
|
|
|
|
it 'should ensure absent when value matches ensure_absent_val' do
|
|
resource = Puppet::Type::Neutron_plugin_nuage.new(
|
|
{:name => 'somename/foo', :value => 'foo', :ensure_absent_val => 'foo' }
|
|
)
|
|
provider = provider_class.new(resource)
|
|
provider.exists?
|
|
expect(resource[:ensure]).to eq :absent
|
|
end
|
|
end
|
|
|