summaryrefslogtreecommitdiff
path: root/spec/unit/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/puppet')
-rw-r--r--spec/unit/puppet/provider/vcsrepo/git_spec.rb10
-rw-r--r--spec/unit/puppet/provider/vcsrepo/svn_spec.rb30
2 files changed, 39 insertions, 1 deletions
diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
index a240b50..87113fa 100644
--- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
@@ -206,7 +206,7 @@ branches
before do
expects_chdir('/tmp/test')
resource[:revision] = 'currentsha'
- resource.delete(:source)
+ resource[:source] = 'http://example.com'
provider.stubs(:git).with('config', 'remote.origin.url').returns('')
provider.stubs(:git).with('fetch', 'origin') # FIXME
provider.stubs(:git).with('fetch', '--tags', 'origin')
@@ -272,6 +272,14 @@ branches
end
end
+ context "when there's no source" do
+ it 'should return the revision' do
+ resource.delete(:source)
+ provider.expects(:git).with('status')
+ provider.expects(:git).with('rev-parse', resource.value(:revision)).returns('currentsha')
+ expect(provider.revision).to eq(resource.value(:revision))
+ end
+ end
end
context "setting the revision property" do
diff --git a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb b/spec/unit/puppet/provider/vcsrepo/svn_spec.rb
index 77f0e03..6a37c20 100644
--- a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/svn_spec.rb
@@ -52,6 +52,36 @@ describe Puppet::Type.type(:vcsrepo).provider(:svn) do
provider.create
end
end
+
+ context "with depth" do
+ it "should execute 'svn checkout' with a depth" do
+ resource[:source] = 'exists'
+ resource[:depth] = 'infinity'
+ provider.expects(:svn).with('--non-interactive', 'checkout', '--depth', 'infinity',
+ resource.value(:source),
+ resource.value(:path))
+ provider.create
+ end
+ 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
+ provider.expects(:svn).with('--non-interactive', '--trust-server-cert', 'checkout',
+ resource.value(:source),
+ resource.value(:path))
+ provider.create
+ end
+ end
end
describe 'destroying' do