diff options
Diffstat (limited to 'spec/unit/util')
| -rwxr-xr-x | spec/unit/util/loadedfile_spec.rb | 7 | ||||
| -rwxr-xr-x | spec/unit/util/rdoc/parser_spec.rb | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/spec/unit/util/loadedfile_spec.rb b/spec/unit/util/loadedfile_spec.rb index 23d2766d7..92daeb953 100755 --- a/spec/unit/util/loadedfile_spec.rb +++ b/spec/unit/util/loadedfile_spec.rb @@ -6,6 +6,7 @@ require 'tempfile' require 'puppet/util/loadedfile' describe Puppet::Util::LoadedFile do + include PuppetSpec::Files before(:each) do @f = Tempfile.new('loadedfile_test') @f.puts "yayness" @@ -18,6 +19,12 @@ describe Puppet::Util::LoadedFile do @fake_now = Time.now + (2 * Puppet[:filetimeout]) end + it "should accept files that don't exist" do + nofile = tmpfile('testfile') + File.exists?(nofile).should == false + lambda{ Puppet::Util::LoadedFile.new(nofile) }.should_not raise_error + end + it "should recognize when the file has not changed" do # Use fake "now" so that we can be sure changed? actually checks, without sleeping # for Puppet[:filetimeout] seconds. diff --git a/spec/unit/util/rdoc/parser_spec.rb b/spec/unit/util/rdoc/parser_spec.rb index ab54c8cd3..f118dc99b 100755 --- a/spec/unit/util/rdoc/parser_spec.rb +++ b/spec/unit/util/rdoc/parser_spec.rb @@ -20,8 +20,9 @@ describe RDoc::Parser do @parser.stubs(:scan_top_level) parser = stub 'parser' Puppet::Parser::Parser.stubs(:new).returns(parser) - parser.expects(:parse).returns(Puppet::Parser::AST::Hostclass.new('')) + parser.expects(:parse).returns(Puppet::Parser::AST::Hostclass.new('')).at_least_once parser.expects(:file=).with("module/manifests/init.pp") + parser.expects(:file=).with("/dev/null/manifests/site.pp") @parser.scan end @@ -29,7 +30,7 @@ describe RDoc::Parser do it "should scan the ast for Puppet files" do parser = stub_everything 'parser' Puppet::Parser::Parser.stubs(:new).returns(parser) - parser.expects(:parse).returns(Puppet::Parser::AST::Hostclass.new('')) + parser.expects(:parse).returns(Puppet::Parser::AST::Hostclass.new('')).at_least_once @parser.expects(:scan_top_level) @@ -39,7 +40,7 @@ describe RDoc::Parser do it "should return a PuppetTopLevel to RDoc" do parser = stub_everything 'parser' Puppet::Parser::Parser.stubs(:new).returns(parser) - parser.expects(:parse).returns(Puppet::Parser::AST::Hostclass.new('')) + parser.expects(:parse).returns(Puppet::Parser::AST::Hostclass.new('')).at_least_once @parser.expects(:scan_top_level) |
