Merge branch '2.3.x'
* 2.3.x: Update CHANGELOG for 2.3.2 release Make file_line default to ensure => present Memoize file_line spec instance variables Fix spec tests using the new spec_helper
This commit is contained in:
commit
e8e2a16ce5
3 changed files with 26 additions and 11 deletions
10
CHANGELOG
10
CHANGELOG
|
@ -1,3 +1,13 @@
|
|||
2012-05-10 - Puppet Labs <support@puppetlabs.com> - 2.3.2
|
||||
* Make file_line default to ensure => present (1373e70)
|
||||
* Memoize file_line spec instance variables (20aacc5)
|
||||
* Fix spec tests using the new spec_helper (1ebfa5d)
|
||||
* (#13595) initialize_everything_for_tests couples modules Puppet ver (3222f35)
|
||||
* (#13439) Fix MRI 1.9 issue with spec_helper (15c5fd1)
|
||||
* (#13439) Fix test failures with Puppet 2.6.x (665610b)
|
||||
* (#13439) refactor spec helper for compatibility with both puppet 2.7 and master (82194ca)
|
||||
* (#13494) Specify the behavior of zero padded strings (61891bb)
|
||||
|
||||
2012-03-29 Puppet Labs <support@puppetlabs.com> - 2.1.3
|
||||
* (#11607) Add Rakefile to enable spec testing
|
||||
* (#12377) Avoid infinite loop when retrying require json
|
||||
|
|
|
@ -23,18 +23,20 @@ Puppet::Type.newtype(:file_line) do
|
|||
|
||||
EOT
|
||||
|
||||
ensurable
|
||||
ensurable do
|
||||
defaultto :present
|
||||
end
|
||||
|
||||
newparam(:name, :namevar => true) do
|
||||
desc 'arbitrary name used as identity'
|
||||
desc 'An arbitrary name used as the identity of the resource.'
|
||||
end
|
||||
|
||||
newparam(:line) do
|
||||
desc 'The line to be appended to the path.'
|
||||
desc 'The line to be appended to the file located by the path parameter.'
|
||||
end
|
||||
|
||||
newparam(:path) do
|
||||
desc 'File to possibly append a line to.'
|
||||
desc 'The file Puppet will ensure contains the line specified by the line parameter.'
|
||||
validate do |value|
|
||||
unless (Puppet.features.posix? and value =~ /^\//) or (Puppet.features.microsoft_windows? and (value =~ /^.:\// or value =~ /^\/\/[^\/]+\/[^\/]+/))
|
||||
raise(Puppet::Error, "File paths must be fully qualified, not '#{value}'")
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
require 'puppet'
|
||||
require 'tempfile'
|
||||
describe Puppet::Type.type(:file_line) do
|
||||
before :each do
|
||||
@file_line = Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'line', :path => '/tmp/path')
|
||||
let :file_line do
|
||||
Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'line', :path => '/tmp/path')
|
||||
end
|
||||
it 'should accept a line and path' do
|
||||
@file_line[:line] = 'my_line'
|
||||
@file_line[:line].should == 'my_line'
|
||||
file_line[:line] = 'my_line'
|
||||
file_line[:line].should == 'my_line'
|
||||
end
|
||||
it 'should accept posix filenames' do
|
||||
@file_line[:path] = '/tmp/path'
|
||||
@file_line[:path].should == '/tmp/path'
|
||||
file_line[:path] = '/tmp/path'
|
||||
file_line[:path].should == '/tmp/path'
|
||||
end
|
||||
it 'should not accept unqualified path' do
|
||||
expect { @file_line[:path] = 'file' }.should raise_error(Puppet::Error, /File paths must be fully qualified/)
|
||||
expect { file_line[:path] = 'file' }.should raise_error(Puppet::Error, /File paths must be fully qualified/)
|
||||
end
|
||||
it 'should require that a line is specified' do
|
||||
expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => '/tmp/file') }.should raise_error(Puppet::Error, /Both line and path are required attributes/)
|
||||
|
@ -21,4 +21,7 @@ describe Puppet::Type.type(:file_line) do
|
|||
it 'should require that a file is specified' do
|
||||
expect { Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'path') }.should raise_error(Puppet::Error, /Both line and path are required attributes/)
|
||||
end
|
||||
it 'should default to ensure => present' do
|
||||
file_line[:ensure].should eq :present
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue