summaryrefslogtreecommitdiff
path: root/spec/unit/puppet/provider/vcsrepo/git_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/puppet/provider/vcsrepo/git_spec.rb')
-rw-r--r--spec/unit/puppet/provider/vcsrepo/git_spec.rb28
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