diff options
author | Luke Kanies <luke@puppetlabs.com> | 2010-07-07 23:34:10 -0700 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-07-09 12:31:45 -0700 |
commit | 3c0059195fb2b1255f368d98021f4a99ecd121a6 (patch) | |
tree | ee22c31b02f14d267a24acce875f3f185fb16617 /spec/unit/parser | |
parent | cea2e5b3fe03de8ef56a97af25ef8b6dd7eb3d7d (diff) | |
download | puppet-3c0059195fb2b1255f368d98021f4a99ecd121a6.tar.gz puppet-3c0059195fb2b1255f368d98021f4a99ecd121a6.tar.xz puppet-3c0059195fb2b1255f368d98021f4a99ecd121a6.zip |
Fix for #4178 - generalize autoloading to include .rb
This mostly modifies autoloading to look for files ending in either 'pp' or
'rb' using Dir globing with {,.pp,.rb} or .{pp,rb} as appropriate. It could
easily be extended to add support for other formats (e.g. xml) by adding them
to the globs (though, if this were to be done often, having a centralized list
of supported extensions would be a good (and easy) refactor).
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'spec/unit/parser')
-rw-r--r-- | spec/unit/parser/files_spec.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/unit/parser/files_spec.rb b/spec/unit/parser/files_spec.rb index 89215344b..df96c0e4c 100644 --- a/spec/unit/parser/files_spec.rb +++ b/spec/unit/parser/files_spec.rb @@ -154,7 +154,7 @@ describe Puppet::Parser::Files do it "should match against provided fully qualified patterns" do pattern = @basepath + "/fully/qualified/pattern/*" - Dir.expects(:glob).with(pattern).returns(%w{my file list}) + Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns(%w{my file list}) Puppet::Parser::Files.find_manifests(pattern)[1].should == %w{my file list} end @@ -168,7 +168,7 @@ describe Puppet::Parser::Files do pattern = @basepath + "/fully/qualified/pattern/*" file = @basepath + "/my/file" dir = @basepath + "/my/directory" - Dir.expects(:glob).with(pattern).returns([file, dir]) + Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns([file, dir]) FileTest.expects(:directory?).with(file).returns(false) FileTest.expects(:directory?).with(dir).returns(true) Puppet::Parser::Files.find_manifests(pattern)[1].should == [file] |