diff options
author | Bryan Jen <bryan.jen@gmail.com> | 2016-02-10 09:34:06 -0700 |
---|---|---|
committer | Bryan Jen <bryan.jen@gmail.com> | 2016-02-10 09:34:06 -0700 |
commit | 818734c0264ffbca9dacc59d358399d819e89ed8 (patch) | |
tree | 15d3378c6f77924bc51951176c8697874631cc7c /spec | |
parent | d7197aa5ab8639163c24ed8ba1d758a0969e51da (diff) | |
parent | b8f25cea95317a4b2a622e2799f1aa7ba159bdca (diff) | |
download | puppet-vcsrepo-818734c0264ffbca9dacc59d358399d819e89ed8.tar.gz puppet-vcsrepo-818734c0264ffbca9dacc59d358399d819e89ed8.tar.bz2 |
Merge pull request #282 from Strech/master
Add mirror option for git cloning
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/puppet/provider/vcsrepo/git_spec.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb index 87113fa..6a8f58f 100644 --- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/git_spec.rb @@ -10,7 +10,7 @@ end remote/origin/foo branches - end + end let(:resource) { Puppet::Type.type(:vcsrepo).new({ :name => 'test', :ensure => :present, @@ -111,6 +111,24 @@ branches end end + context "with an ensure of mirror" do + context "with revision" do + it "should raise an error" do + resource[:ensure] = :mirror + expect { provider.create }.to raise_error Puppet::Error, /cannot set a revision.+bare/i + end + end + context "without revision" do + it "should just execute 'git clone --mirror'" do + resource[:ensure] = :mirror + resource.delete(:revision) + provider.expects(:git).with('clone', '--mirror', resource.value(:source), resource.value(:path)) + provider.expects(:update_remotes) + provider.create + end + end + end + context "when a source is not given" do context "when the path does not exist" do it "should execute 'git init'" do @@ -157,6 +175,14 @@ branches provider.expects(:git).with('init', '--bare') provider.create end + + it "should raise an exeption" do + resource[:ensure] = :mirror + resource.delete(:source) + resource.delete(:revision) + + expect { provider.create }.to raise_error Puppet::Error, /cannot init repository with mirror.+try bare/i + end end context "when the path is a working copy repository" do |