diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2011-03-25 16:24:01 -0700 |
|---|---|---|
| committer | Jesse Wolfe <jes5199@gmail.com> | 2011-03-25 16:24:01 -0700 |
| commit | cc43dd79ad8d40b5b7bf3f4480ff794e99f733a4 (patch) | |
| tree | 22a21fb53c44bcb433dafb8bb373e3f41afde6eb /spec | |
| parent | c0236aab1145e01e26f59cf1d823dc6966ba567b (diff) | |
| parent | 0fec21fcd887685cf8421fdc309b878088f9fc48 (diff) | |
| download | puppet-cc43dd79ad8d40b5b7bf3f4480ff794e99f733a4.tar.gz puppet-cc43dd79ad8d40b5b7bf3f4480ff794e99f733a4.tar.xz puppet-cc43dd79ad8d40b5b7bf3f4480ff794e99f733a4.zip | |
Merge commit '2.6.next^1' into next
These changes were superseded by existing commits in next:
lib/puppet/parser/compiler.rb
spec/unit/parser/compiler_spec.rb
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/file_serving/fileset_spec.rb | 8 | ||||
| -rwxr-xr-x | spec/unit/type/exec_spec.rb | 16 |
2 files changed, 22 insertions, 2 deletions
diff --git a/spec/unit/file_serving/fileset_spec.rb b/spec/unit/file_serving/fileset_spec.rb index 1ef9cdc50..3b12c953e 100755 --- a/spec/unit/file_serving/fileset_spec.rb +++ b/spec/unit/file_serving/fileset_spec.rb @@ -13,6 +13,14 @@ describe Puppet::FileServing::Fileset, " when initializing" do proc { Puppet::FileServing::Fileset.new("some/file") }.should raise_error(ArgumentError) end + it "should not fail if the path is fully qualified, with a trailing separator" do + path = "/some/path/with/trailing/separator" + path_with_separator = "#{path}#{File::SEPARATOR}" + File.stubs(:lstat).with(path).returns stub('stat') + fileset = Puppet::FileServing::Fileset.new(path_with_separator) + fileset.path.should == path + end + it "should fail if its path does not exist" do File.expects(:lstat).with("/some/file").returns nil proc { Puppet::FileServing::Fileset.new("/some/file") }.should raise_error(ArgumentError) diff --git a/spec/unit/type/exec_spec.rb b/spec/unit/type/exec_spec.rb index a1ffb1636..86b824423 100755 --- a/spec/unit/type/exec_spec.rb +++ b/spec/unit/type/exec_spec.rb @@ -307,7 +307,7 @@ describe Puppet::Type.type(:exec) do end describe "when setting timeout" do - [-3.5, -1, 0, 0.1, 1, 10, 4294967295].each do |valid| + [0, 0.1, 1, 10, 4294967295].each do |valid| it "should accept '#{valid}' as valid" do @exec[:timeout] = valid @exec[:timeout].should == valid @@ -319,7 +319,7 @@ describe Puppet::Type.type(:exec) do end end - ['1/2', '1_000_000', '+12', '', 'foo'].each do |invalid| + ['1/2', '', 'foo', '5foo'].each do |invalid| it "should reject '#{invalid}' as invalid" do expect { @exec[:timeout] = invalid }. should raise_error Puppet::Error, /The timeout must be a number/ @@ -337,6 +337,18 @@ describe Puppet::Type.type(:exec) do sleep_exec = Puppet::Type.type(:exec).new(:name => 'sleep 1', :path => ['/bin'], :timeout => '0.2') lambda { sleep_exec.refresh }.should raise_error Puppet::Error, "Command exceeded timeout" end + + it "should convert timeout to a float" do + resource = Puppet::Type.type(:exec).new :command => "/bin/false", :timeout => "12" + resource[:timeout].should be_a(Float) + resource[:timeout].should == 12.0 + end + + it "should munge negative timeouts to 0.0" do + resource = Puppet::Type.type(:exec).new :command => "/bin/false", :timeout => "-12.0" + resource.parameter(:timeout).value.should be_a(Float) + resource.parameter(:timeout).value.should == 0.0 + end end describe "when setting tries" do |
