Fix :false to be default value
authorHunter Haugen <hunter@puppetlabs.com>
Thu, 15 Oct 2015 17:42:01 +0000 (10:42 -0700)
committerHunter Haugen <hunter@puppetlabs.com>
Thu, 15 Oct 2015 18:02:07 +0000 (11:02 -0700)
false is not a valid value; only :false is.

Gemfile
lib/puppet/provider/vcsrepo/svn.rb
lib/puppet/type/vcsrepo.rb
spec/unit/puppet/provider/vcsrepo/svn_spec.rb

diff --git a/Gemfile b/Gemfile
index bfe64b1..ee1eb6b 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -16,6 +16,7 @@ group :development, :unit_tests do
   gem 'simplecov',               :require => false
   gem 'puppet_facts',            :require => false
   gem 'json',                    :require => false
+  gem 'pry',                     :require => false
 end
 
 group :system_tests do
index ba77464..fccfaa5 100644 (file)
@@ -63,7 +63,7 @@ Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo)
       args.push('--config-dir', @resource.value(:configuration))
     end
 
-    if @resource.value(:trust_server_cert)
+    if @resource.value(:trust_server_cert) != :false
       args.push('--trust-server-cert')
     end
 
index da1dcde..290bdad 100644 (file)
@@ -231,7 +231,7 @@ Puppet::Type.newtype(:vcsrepo) do
   newparam :trust_server_cert do
     desc "Trust server certificate"
     newvalues(:true, :false)
-    defaultto false
+    defaultto :false
   end
 
   autorequire(:package) do
index 25951bd..6a37c20 100644 (file)
@@ -65,9 +65,17 @@ describe Puppet::Type.type(:vcsrepo).provider(:svn) do
     end
     
     context "with trust_server_cert" do
+      it "should execute 'svn checkout' without a trust-server-cert" do
+        resource[:source] = 'exists'
+        resource[:trust_server_cert] = :false
+        provider.expects(:svn).with('--non-interactive', 'checkout',
+          resource.value(:source),
+          resource.value(:path))
+        provider.create
+      end
       it "should execute 'svn checkout' with a trust-server-cert" do
         resource[:source] = 'exists'
-        resource[:trust_server_cert] = true
+        resource[:trust_server_cert] = :true
         provider.expects(:svn).with('--non-interactive', '--trust-server-cert', 'checkout',
           resource.value(:source),
           resource.value(:path))