From 21eab22997732b98850320906e514b50f6b6fe97 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 27 Apr 2007 23:25:59 +0000 Subject: Okay, one last try -- the Util#binary command was not returning a path in all true cases, and the provider tests were poorly written and missed it. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2427 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/util.rb | 2 +- test/ral/manager/provider.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb index 8e07a27a1..777afab5f 100644 --- a/lib/puppet/util.rb +++ b/lib/puppet/util.rb @@ -221,7 +221,7 @@ module Util def binary(bin) if bin =~ /^\// if FileTest.exists? bin - return true + return bin else return nil end diff --git a/test/ral/manager/provider.rb b/test/ral/manager/provider.rb index cafb84deb..0394634af 100755 --- a/test/ral/manager/provider.rb +++ b/test/ral/manager/provider.rb @@ -56,7 +56,7 @@ class TestTypeProviders < Test::Unit::TestCase cleanup { Puppet::Type.rmtype(:commands) } echo = %x{which echo}.chomp - {:echo => echo, :echo => "echo", :missing => "nosuchcommand", :missing => "/path/to/nosuchcommand"}.each do |name, command| + {:echo_plain => "echo", :echo_with_path => echo, :missing_unqualified => "nosuchcommand", :missing_qualified => "/path/to/nosuchcommand"}.each do |name, command| # Define a provider with mandatory commands provider = type.provide(:testing) {} @@ -64,12 +64,12 @@ class TestTypeProviders < Test::Unit::TestCase provider.commands(name => command) end - case name - when :echo: - assert_equal(echo, provider.command(:echo), "Did not get correct path for echo") + case name.to_s + when /echo/ + assert_equal(echo, provider.command(name), "Did not get correct path for echo") assert(provider.suitable?, "Provider was not considered suitable with 'echo'") - when :missing: - assert_nil(provider.command(:missing), "Somehow got a response for missing commands") + when /missing/ + assert_nil(provider.command(name), "Somehow got a response for missing commands") assert(! provider.suitable?, "Provider was considered suitable with missing command") else raise "Invalid name %s" % name -- cgit