diff options
| author | Luke Kanies <luke@madstop.com> | 2009-02-19 12:57:29 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2009-02-19 17:51:21 -0600 |
| commit | b800bde30bd5a08f5e222725588062e2bca37a79 (patch) | |
| tree | 5d56ddb761a7892e883b7be62b1d3eeb5ca3fced /spec/unit/parser | |
| parent | d7864bedafcca07806f6da3e3f472dc80d3206b7 (diff) | |
Refactoring how the Settings file is parsed
The goal of this refactor was to use a cached attribute
for the LoadedFile instance we use to monitor whether
the file needs reparsing. We were getting tests that
affected later tests because they were holding on to
LoadedFile stubs, somehow.
The other main change here is that the Settings#parse
method now knows how to look up its own file path.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/parser')
| -rwxr-xr-x | spec/unit/parser/interpreter.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/spec/unit/parser/interpreter.rb b/spec/unit/parser/interpreter.rb index 211f42df0..fe63bbd65 100755 --- a/spec/unit/parser/interpreter.rb +++ b/spec/unit/parser/interpreter.rb @@ -35,11 +35,9 @@ describe Puppet::Parser::Interpreter do # Set our per-environment values. We can't just stub :value, because # it's called by too much of the rest of the code. text = "[env1]\nmanifest = /t/env1.pp\n[env2]\nmanifest = /t/env2.pp" - file = mock 'file' - file.stubs(:changed?).returns(true) - file.stubs(:file).returns("/whatever") - Puppet.settings.stubs(:read_file).with(file).returns(text) - Puppet.settings.parse(file) + FileTest.stubs(:exist?).returns true + Puppet.settings.stubs(:read_file).returns(text) + Puppet.settings.parse parser1 = mock 'parser1' Puppet::Parser::Parser.expects(:new).with(:environment => :env1).returns(parser1) |
