diff options
author | Chris Price <chris@puppetlabs.com> | 2012-09-20 11:35:45 -0700 |
---|---|---|
committer | Chris Price <chris@puppetlabs.com> | 2012-09-20 11:35:45 -0700 |
commit | e527908b7c6ac5d91677229a96d5a97194dc68b7 (patch) | |
tree | 363d5bd285f3f03e113b08b1deae5eac45eb98da /spec/unit | |
parent | 8d1fdc5c29d70027b0f1859145ced5ebb266cf9c (diff) | |
download | puppet-inifile-e527908b7c6ac5d91677229a96d5a97194dc68b7.tar.gz puppet-inifile-e527908b7c6ac5d91677229a96d5a97194dc68b7.tar.bz2 |
Add validation for key_val_separator
For now, the key_val_separator is required to contain
exactly one '=' character. This commit simply validates
that that is the case.
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/puppet/provider/ini_setting/ruby_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/unit/puppet/provider/ini_setting/ruby_spec.rb b/spec/unit/puppet/provider/ini_setting/ruby_spec.rb index ac9bb91..20882fd 100644 --- a/spec/unit/puppet/provider/ini_setting/ruby_spec.rb +++ b/spec/unit/puppet/provider/ini_setting/ruby_spec.rb @@ -400,6 +400,26 @@ foo=bar EOS } + it "should fail if the separator doesn't include an equals sign" do + expect { + Puppet::Type::Ini_setting.new(common_params.merge( + :section => 'section2', + :setting => 'foo', + :value => 'yippee', + :key_val_separator => '+')) + }.to raise_error Puppet::Error, /must contain exactly one/ + end + + it "should fail if the separator includes more than one equals sign" do + expect { + Puppet::Type::Ini_setting.new(common_params.merge( + :section => 'section2', + :setting => 'foo', + :value => 'yippee', + :key_val_separator => ' = foo = ')) + }.to raise_error Puppet::Error, /must contain exactly one/ + end + it "should modify an existing setting" do resource = Puppet::Type::Ini_setting.new(common_params.merge( :section => 'section2', |