summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2011-03-24 17:51:59 -0700
committerJesse Wolfe <jes5199@gmail.com>2011-03-25 15:43:58 -0700
commit7c60db5d9db8eeda46f7041100759e69aed120a8 (patch)
treeb1236106ed4fcd746c5ec8dee2f5028152eea93d /spec/unit/parser
parent0f3e537a127ff0a55e25e0eea4b7513529867df3 (diff)
downloadpuppet-7c60db5d9db8eeda46f7041100759e69aed120a8.tar.gz
puppet-7c60db5d9db8eeda46f7041100759e69aed120a8.tar.xz
puppet-7c60db5d9db8eeda46f7041100759e69aed120a8.zip
(#5477) Allow watch_file to watch non-existent files, especially site.pp
The watch_file mechanism would refuse to monitor paths to files that didn't exist. This patch makes it possible to watch a file that hasn't been created yet, so when it is created, you manifests will get reparsed. Backported this change to 2.6.x Paired-With: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-xspec/unit/parser/lexer_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb
index 4ef242cf5..d144504c5 100755
--- a/spec/unit/parser/lexer_spec.rb
+++ b/spec/unit/parser/lexer_spec.rb
@@ -679,3 +679,15 @@ describe "Puppet::Parser::Lexer in the old tests when lexing example files" do
end
end
end
+
+describe "when trying to lex an non-existent file" do
+ include PuppetSpec::Files
+
+ it "should return an empty list of tokens" do
+ lexer = Puppet::Parser::Lexer.new
+ lexer.file = nofile = tmpfile('lexer')
+ File.exists?(nofile).should == false
+
+ lexer.fullscan.should == [[false,false]]
+ end
+end