X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Finifile%2Fspec%2Funit%2Fpuppet%2Fprovider%2Fini_setting%2Finheritance_spec.rb;fp=3rdparty%2Fmodules%2Finifile%2Fspec%2Funit%2Fpuppet%2Fprovider%2Fini_setting%2Finheritance_spec.rb;h=0000000000000000000000000000000000000000;hb=6e1426dc77fb4e5d51f07c187c6f2219431dc31e;hp=4dd6c3f5bc47db87434732478904d0cf32cba3e5;hpb=87423ba664cd5f2bb462ebadd08b1a90d0fe1c8d;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/inifile/spec/unit/puppet/provider/ini_setting/inheritance_spec.rb b/3rdparty/modules/inifile/spec/unit/puppet/provider/ini_setting/inheritance_spec.rb deleted file mode 100644 index 4dd6c3f5b..000000000 --- a/3rdparty/modules/inifile/spec/unit/puppet/provider/ini_setting/inheritance_spec.rb +++ /dev/null @@ -1,67 +0,0 @@ -require 'spec_helper' - -# This is a reduced version of ruby_spec.rb just to ensure we can subclass as -# documented -$: << 'spec/fixtures/modules/inherit_ini_setting/lib' -provider_class = Puppet::Type.type(:inherit_ini_setting).provider(:ini_setting) -describe provider_class do - include PuppetlabsSpec::Files - - let(:tmpfile) { tmpfilename('inherit_ini_setting_test') } - - def validate_file(expected_content,tmpfile = tmpfile) - File.read(tmpfile).should == expected_content - end - - - before :each do - File.open(tmpfile, 'w') do |fh| - fh.write(orig_content) - end - end - - context 'when calling instances' do - let(:orig_content) { '' } - - it 'should parse nothing when the file is empty' do - provider_class.stubs(:file_path).returns(tmpfile) - provider_class.instances.should == [] - end - - context 'when the file has contents' do - let(:orig_content) { - <<-EOS -# A comment -red = blue -green = purple - EOS - } - - it 'should parse the results' do - provider_class.stubs(:file_path).returns(tmpfile) - instances = provider_class.instances - instances.size.should == 2 - # inherited version of namevar flattens the names - names = instances.map do |instance| - instance.instance_variable_get(:@property_hash)[:name] - end - names.sort.should == [ 'green', 'red' ] - end - end - end - - context 'when ensuring that a setting is present' do - let(:orig_content) { '' } - - it 'should add a value to the file' do - provider_class.stubs(:file_path).returns(tmpfile) - resource = Puppet::Type::Inherit_ini_setting.new({ - :setting => 'set_this', - :value => 'to_that', - }) - provider = described_class.new(resource) - provider.create - validate_file("set_this=to_that\n") - end - end -end