Sha256: ca42966ca4158b801238fe2eba07fa1db3ba1af7144983581840dc6bca9fd7aa
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 KB
Contents
#! /usr/bin/env ruby -S rspec require 'spec_helper' require 'puppet/util/config_timeout' describe Puppet::Util::ConfigTimeout do # NOTE: in the future it might be a good idea to add an explicit "integer" type to # the settings types, in which case this would no longer be necessary. class TestConfigTimeout include Puppet::Util::ConfigTimeout end let :instance do TestConfigTimeout.new end context "when the config setting is a String" do context "which contains an integer" do it "should convert the string to an integer" do Puppet[:configtimeout] = "12" instance.timeout_interval.should == 12 end end context "which does not contain an integer do" do it "should raise an ArgumentError" do Puppet[:configtimeout] = "foo" expect { instance.timeout_interval }.to raise_error(ArgumentError) end end end context "when the config setting is an Integer" do it "should return the integer" do Puppet[:configtimeout] = 12 instance.timeout_interval.should == 12 end end context "when the config setting is some other type" do # test a random smattering of types [Hash.new, Array.new, Object.new].each do |obj| context "when the config setting is a #{obj.class}" do it "should raise an ArgumentError" do Puppet[:configtimeout] = Hash.new expect { instance.timeout_interval }.to raise_error(ArgumentError) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
puppet-3.0.0.rc5 | spec/unit/util/config_timeout_spec.rb |
puppet-3.0.0.rc4 | spec/unit/util/config_timeout_spec.rb |