3 provider_class = Puppet::Type.type(:file_line).provider(:ruby)
4 describe provider_class do
6 tmp = Tempfile.new('tmp')
9 @resource = Puppet::Type::File_line.new(
10 {:name => 'foo', :path => @tmpfile, :line => 'foo'}
12 @provider = provider_class.new(@resource)
14 it 'should detect if the line exists in the file' do
15 File.open(@tmpfile, 'w') do |fh|
18 @provider.exists?.should be_true
20 it 'should detect if the line does not exist in the file' do
21 File.open(@tmpfile, 'w') do |fh|
24 @provider.exists?.should be_nil
26 it 'should append to an existing file when creating' do
28 File.read(@tmpfile).chomp.should == 'foo'