Please review pull request #689: (maint) Get provider specs working on windows opened by (jeffweiss)
Description:
Define helper to provider an existing command for windows because "echo"
is a shell interpreted command, not a proper executable.
As a side note, a helper method was the only way this actually functions
because of the evaluation context of the confine scenarios hash. Let,
before(:each), and instance variable all fail.
- Opened: Thu Apr 19 16:44:10 UTC 2012
- Based on: puppetlabs:master (b7c4fe3ef4ccd9b514d2c48167fe314558eecd31)
- Requested merge: jeffweiss:maint/master/fix_provider_specs_for_windows (27c9bc0d57d48a5e48faa56293a6d383ed55ef1f)
Diff follows:
diff --git a/spec/unit/provider_spec.rb b/spec/unit/provider_spec.rb
index da850ec..9abdc24 100755
--- a/spec/unit/provider_spec.rb
+++ b/spec/unit/provider_spec.rb
@@ -1,6 +1,10 @@
#!/usr/bin/env rspec
require 'spec_helper'
+def existing_command
+ Facter.value(:operatingsystem) =~ /windows/ ? "cmd" : "echo"
+end
+
describe Puppet::Provider do
before :each do
Puppet::Type.newtype(:test) do
@@ -247,14 +251,14 @@
{ :operatingsystem => Facter.value(:operatingsystem) } => true,
{ :operatingsystem => :yayness } => false,
{ :nothing => :yayness } => false,
- { :exists => Puppet::Util.which("echo") } => true,
+ { :exists => Puppet::Util.which(existing_command) } => true,
{ :exists => "/this/file/does/not/exist" } => false,
- { :true => true, :exists => Puppet::Util.which("echo") } => true,
+ { :true => true, :exists => Puppet::Util.which(existing_command) } => true,
{ :true => true, :exists => "/this/file/does/not/exist" } => false,
{ :operatingsystem => Facter.value(:operatingsystem),
- :exists => Puppet::Util.which("echo") } => true,
+ :exists => Puppet::Util.which(existing_command) } => true,
{ :operatingsystem => :yayness,
- :exists => Puppet::Util.which("echo") } => false,
+ :exists => Puppet::Util.which(existing_command) } => false,
{ :operatingsystem => Facter.value(:operatingsystem),
:exists => "/this/file/does/not/exist" } => false,
{ :operatingsystem => :yayness,
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
