summaryrefslogtreecommitdiff
path: root/spec/unit/puppet/type/file_line_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/puppet/type/file_line_spec.rb')
-rwxr-xr-xspec/unit/puppet/type/file_line_spec.rb25
1 files changed, 24 insertions, 1 deletions
diff --git a/spec/unit/puppet/type/file_line_spec.rb b/spec/unit/puppet/type/file_line_spec.rb
index c559e44..150149b 100755
--- a/spec/unit/puppet/type/file_line_spec.rb
+++ b/spec/unit/puppet/type/file_line_spec.rb
@@ -47,6 +47,24 @@ describe Puppet::Type.type(:file_line) do
:match => '^\s*foo=.*$'
)}.not_to raise_error
end
+ it 'should accept utf8 characters' do
+ expect {
+ Puppet::Type.type(:file_line).new(
+ :name => 'ƒồỗ',
+ :path => my_path,
+ :line => 'ƒồỗ=ьåя',
+ :match => '^ьåя=βļάħ$'
+ )}.not_to raise_error
+ end
+ it 'should accept double byte characters' do
+ expect {
+ Puppet::Type.type(:file_line).new(
+ :name => 'フーバー',
+ :path => my_path,
+ :line => 'この=それ',
+ :match => '^この=ああ$'
+ )}.not_to raise_error
+ end
it 'should accept posix filenames' do
file_line[:path] = tmp_path
expect(file_line[:path]).to eq(tmp_path)
@@ -69,7 +87,12 @@ describe Puppet::Type.type(:file_line) do
it 'should default to replace => true' do
expect(file_line[:replace]).to eq :true
end
-
+ it 'should default to encoding => UTF-8' do
+ expect(file_line[:encoding]).to eq 'UTF-8'
+ end
+ it 'should accept encoding => iso-8859-1' do
+ expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path, :ensure => :present, :encoding => 'iso-8859-1', :line => 'bar') }.not_to raise_error
+ end
it "should autorequire the file it manages" do
catalog = Puppet::Resource::Catalog.new
file = Puppet::Type.type(:file).new(:name => tmp_path)