diff options
| author | Luke Kanies <luke@reductivelabs.com> | 2010-01-04 16:43:15 -0800 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | df2d39248dd0bb2adc7b4f723722079cad2749ad (patch) | |
| tree | c79be8a9d6055b532950a453ff5b951ef6fe8b72 /spec/unit/parser | |
| parent | b938edf35fc50e6a43aa09f1ec8415b19f06b2af (diff) | |
Adding support for parsing ruby files
This doesn't work without the later commits - it just relies
on Ruby to read in Ruby files.
Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'spec/unit/parser')
| -rwxr-xr-x | spec/unit/parser/parser.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/unit/parser/parser.rb b/spec/unit/parser/parser.rb index 6a8b0e3be..f10517fd7 100755 --- a/spec/unit/parser/parser.rb +++ b/spec/unit/parser/parser.rb @@ -12,6 +12,29 @@ describe Puppet::Parser do @true_ast = Puppet::Parser::AST::Boolean.new :value => true end + describe "when parsing files" do + before do + FileTest.stubs(:exist?).returns true + File.stubs(:open) + @parser.stubs(:check_and_add_to_watched_files).returns true + end + + it "should treat files ending in 'rb' as ruby files" do + @parser.expects(:parse_ruby_file) + @parser.file = "/my/file.rb" + @parser.parse + end + + describe "in ruby" do + it "should use the ruby interpreter to load the file" do + @parser.file = "/my/file.rb" + @parser.expects(:require).with "/my/file.rb" + + @parser.parse_ruby_file + end + end + end + describe "when parsing append operator" do it "should not raise syntax errors" do |
