diff options
author | Josh Cooper <josh@puppetlabs.com> | 2011-07-18 23:05:35 -0700 |
---|---|---|
committer | Josh Cooper <josh@puppetlabs.com> | 2011-07-19 14:06:36 -0700 |
commit | 462a95e3d077b1915a919399b846068816c84583 (patch) | |
tree | f2e260c6d923d49f20a3d6094796aae36ec240fe /spec/unit/transaction/event_manager_spec.rb | |
parent | 45ae5b4a9ced26dfcd3e324391f9a26cb02bf93d (diff) | |
download | puppet-462a95e3d077b1915a919399b846068816c84583.tar.gz puppet-462a95e3d077b1915a919399b846068816c84583.tar.xz puppet-462a95e3d077b1915a919399b846068816c84583.zip |
Fix tests with "relative" paths on Windows
Absolute paths on Unix, e.g. /foo/bar, are not absolute on Windows,
which breaks many test cases. This commit adds a method to
PuppetSpec::Files.make_absolute that makes the path absolute in
test cases.
On Unix (Puppet.features.posix?) it is a no-op. On Windows,
(Puppet.features.microsoft_windows?) the drive from the current
working directory is prepended.
Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'spec/unit/transaction/event_manager_spec.rb')
-rwxr-xr-x | spec/unit/transaction/event_manager_spec.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/unit/transaction/event_manager_spec.rb b/spec/unit/transaction/event_manager_spec.rb index d127d0391..37775997d 100755 --- a/spec/unit/transaction/event_manager_spec.rb +++ b/spec/unit/transaction/event_manager_spec.rb @@ -4,6 +4,8 @@ require 'spec_helper' require 'puppet/transaction/event_manager' describe Puppet::Transaction::EventManager do + include PuppetSpec::Files + describe "at initialization" do it "should require a transaction" do Puppet::Transaction::EventManager.new("trans").transaction.should == "trans" @@ -23,7 +25,7 @@ describe Puppet::Transaction::EventManager do before do @manager = Puppet::Transaction::EventManager.new(@transaction) - @resource = Puppet::Type.type(:file).new :path => "/my/file" + @resource = Puppet::Type.type(:file).new :path => make_absolute("/my/file") @graph = stub 'graph', :matching_edges => [], :resource => @resource @manager.stubs(:relationship_graph).returns @graph @@ -139,7 +141,7 @@ describe Puppet::Transaction::EventManager do @manager = Puppet::Transaction::EventManager.new(@transaction) @manager.stubs(:queue_events) - @resource = Puppet::Type.type(:file).new :path => "/my/file" + @resource = Puppet::Type.type(:file).new :path => make_absolute("/my/file") @event = Puppet::Transaction::Event.new(:name => :event, :resource => @resource) end |