]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/stdlib/spec/unit/puppet/type/file_line_spec.rb
upgrade to concat 2.0.0
[dsa-puppet.git] / modules / stdlib / spec / unit / puppet / type / file_line_spec.rb
1 require 'puppet'
2 require 'tempfile'
3 describe Puppet::Type.type(:file_line) do
4   before :each do
5     @file_line = Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'line', :path => '/tmp/path')
6   end
7   it 'should accept a line and path' do
8     @file_line[:line] = 'my_line'
9     @file_line[:line].should == 'my_line'
10   end
11   it 'should accept posix filenames' do
12     @file_line[:path] = '/tmp/path'
13     @file_line[:path].should == '/tmp/path'
14   end
15   it 'should not accept unqualified path' do
16     expect { @file_line[:path] = 'file' }.should raise_error(Puppet::Error, /File paths must be fully qualified/)
17   end
18   it 'should require that a line is specified' do
19     expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => '/tmp/file') }.should raise_error(Puppet::Error, /Both line and path are required attributes/)
20   end
21   it 'should require that a file is specified' do
22     expect { Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'path') }.should raise_error(Puppet::Error, /Both line and path are required attributes/)
23   end
24 end