summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/puppet/provider/vcsrepo/bzr_spec.rb2
-rw-r--r--spec/unit/puppet/provider/vcsrepo/cvs_spec.rb22
-rw-r--r--spec/unit/puppet/provider/vcsrepo/git_spec.rb36
-rw-r--r--spec/unit/puppet/provider/vcsrepo/hg_spec.rb22
-rw-r--r--spec/unit/puppet/provider/vcsrepo/svn_spec.rb6
5 files changed, 44 insertions, 44 deletions
diff --git a/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb b/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb
index c50574a..cccbaa6 100644
--- a/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb
@@ -78,7 +78,7 @@ describe_provider :vcsrepo, :bzr, :resource => {:path => '/tmp/vcsrepo'} do
end
end
end
-
+
describe "setting the revision property" do
it "should use 'bzr update -r' with the revision" do
revision = 'somerev'
diff --git a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb
index c16c7ea..4c15757 100644
--- a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb
@@ -10,24 +10,24 @@ describe_provider :vcsrepo, :cvs, :resource => {:path => '/tmp/vcsrepo'} do
expects_chdir(File.dirname(resource.value(:path)))
#provider.expects(:cvs).with('update', '-r', resource.value(:revision), '.')
provider.create
- end
+ end
end
-
+
resource_without :revision do
it "should just execute 'cvs checkout' without a revision" do
provider.expects(:cvs).with('-d', resource.value(:source), 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source)))
provider.create
- end
+ end
end
-
+
context "with a compression", :resource => {:compression => '3'} do
it "should just execute 'cvs checkout' without a revision" do
provider.expects(:cvs).with('-d', resource.value(:source), '-z', '3', 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source)))
provider.create
- end
+ end
end
end
-
+
context "when a source is not given" do
it "should execute 'cvs init'" do
provider.expects(:cvs).with('-d', resource.value(:path), 'init')
@@ -50,7 +50,7 @@ describe_provider :vcsrepo, :cvs, :resource => {:path => '/tmp/vcsrepo'} do
provider.exists?
end
end
-
+
resource_without :source do
it "should check for the CVSROOT directory" do
File.expects(:directory?).with(File.join(resource.value(:path), 'CVSROOT'))
@@ -63,7 +63,7 @@ describe_provider :vcsrepo, :cvs, :resource => {:path => '/tmp/vcsrepo'} do
before do
@tag_file = File.join(resource.value(:path), 'CVS', 'Tag')
end
-
+
context "when CVS/Tag exists" do
before do
@tag = 'TAG'
@@ -74,7 +74,7 @@ describe_provider :vcsrepo, :cvs, :resource => {:path => '/tmp/vcsrepo'} do
provider.revision.should == @tag
end
end
-
+
context "when CVS/Tag does not exist" do
before do
File.expects(:exist?).with(@tag_file).returns(false)
@@ -84,12 +84,12 @@ describe_provider :vcsrepo, :cvs, :resource => {:path => '/tmp/vcsrepo'} do
end
end
end
-
+
describe "when setting the revision property" do
before do
@tag = 'SOMETAG'
end
-
+
it "should use 'cvs update -dr'" do
expects_chdir
provider.expects('cvs').with('update', '-dr', @tag, '.')
diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
index 240b2b8..7d5d327 100644
--- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
@@ -24,7 +24,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
provider.expects(:git).with('checkout', '--force', resource.value(:revision))
provider.create
end
- end
+ end
resource_without :revision do
it "should execute 'git clone' and submodule commands" do
provider.expects(:git).with('clone', resource.value(:source), resource.value(:path))
@@ -33,7 +33,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
end
end
end
-
+
resource_with :ensure => :bare do
resource_with :revision do
it "should just execute 'git clone --bare'" do
@@ -41,7 +41,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
provider.create
end
end
-
+
resource_without :revision do
it "should just execute 'git clone --bare'" do
provider.expects(:git).with('clone', '--bare', resource.value(:source), resource.value(:path))
@@ -50,7 +50,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
end
end
end
-
+
context "when a source is not given" do
resource_with :ensure => :present do
context "when the path does not exist" do
@@ -63,7 +63,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
provider.create
end
end
-
+
context "when the path is a bare repository" do
it "should convert it to a working copy" do
provider.expects(:bare_exists?).returns(true)
@@ -71,7 +71,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
provider.create
end
end
-
+
context "when the path is not a repository" do
it "should raise an exception" do
provider.expects(:path_exists?).returns(true)
@@ -79,7 +79,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
end
end
end
-
+
resource_with :ensure => :bare do
context "when the path does not exist" do
it "should execute 'git init --bare'" do
@@ -91,7 +91,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
provider.create
end
end
-
+
context "when the path is a working copy repository" do
it "should convert it to a bare repository" do
provider.expects(:working_copy_exists?).returns(true)
@@ -99,7 +99,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
provider.create
end
end
-
+
context "when the path is not a repository" do
it "should raise an exception" do
expects_directory?(true)
@@ -110,21 +110,21 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
end
end
-
+
context 'destroying' do
it "it should remove the directory" do
expects_rm_rf
provider.destroy
end
end
-
+
context "checking the revision property" do
resource_with :revision do
before do
expects_chdir
provider.expects(:git).with('rev-parse', 'HEAD').returns('currentsha')
end
-
+
context "when its SHA is not different than the current SHA" do
it "should return the ref" do
provider.expects(:git).with('fetch', 'origin') # FIXME
@@ -134,7 +134,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
provider.revision.should == resource.value(:revision)
end
end
-
+
context "when its SHA is different than the current SHA" do
it "should return the current SHA" do
provider.expects(:git).with('fetch', 'origin') # FIXME
@@ -146,7 +146,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
end
end
end
-
+
context "setting the revision property" do
before do
expects_chdir
@@ -183,9 +183,9 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
provider.expects(:git).with('submodule', 'foreach', 'git', 'submodule', 'update')
provider.revision = resource.value(:revision)
end
- end
+ end
end
-
+
context "updating references" do
it "should use 'git fetch --tags'" do
expects_chdir
@@ -223,7 +223,7 @@ describe_provider :vcsrepo, :git, :resource => {:path => '/tmp/vcsrepo'} do
provider.should_not be_remote_branch_revision
end
end
- end
+ end
end
-
+
end
diff --git a/spec/unit/puppet/provider/vcsrepo/hg_spec.rb b/spec/unit/puppet/provider/vcsrepo/hg_spec.rb
index 318ddb0..948bfe0 100644
--- a/spec/unit/puppet/provider/vcsrepo/hg_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/hg_spec.rb
@@ -11,17 +11,17 @@ describe_provider :vcsrepo, :hg, :resource => {:path => '/tmp/vcsrepo'} do
resource.value(:source),
resource.value(:path))
provider.create
- end
+ end
end
-
+
resource_without :revision do
it "should just execute 'hg clone' without a revision" do
provider.expects(:hg).with('clone', resource.value(:source), resource.value(:path))
provider.create
- end
+ end
end
end
-
+
context "when a source is not given" do
it "should execute 'hg init'" do
provider.expects(:hg).with('init', resource.value(:path))
@@ -48,37 +48,37 @@ describe_provider :vcsrepo, :hg, :resource => {:path => '/tmp/vcsrepo'} do
before do
expects_chdir
end
-
+
context "when given a non-SHA as the resource revision" do
before do
provider.expects(:hg).with('parents').returns(fixture(:hg_parents))
provider.expects(:hg).with('tags').returns(fixture(:hg_tags))
end
-
+
context "when its SHA is not different than the current SHA", :resource => {:revision => '0.6'} do
it "should return the ref" do
provider.revision.should == '0.6'
end
end
-
+
context "when its SHA is different than the current SHA", :resource => {:revision => '0.5.3'} do
it "should return the current SHA" do
provider.revision.should == '34e6012c783a'
- end
+ end
end
end
context "when given a SHA as the resource revision" do
before do
provider.expects(:hg).with('parents').returns(fixture(:hg_parents))
end
-
+
context "when it is the same as the current SHA", :resource => {:revision => '34e6012c783a'} do
it "should return it" do
provider.expects(:hg).with('tags').returns(fixture(:hg_tags))
provider.revision.should == resource.value(:revision)
end
end
-
+
context "when it is not the same as the current SHA", :resource => {:revision => 'not-the-same'} do
it "should return the current SHA" do
provider.expects(:hg).with('tags').returns(fixture(:hg_tags))
@@ -87,7 +87,7 @@ describe_provider :vcsrepo, :hg, :resource => {:path => '/tmp/vcsrepo'} do
end
end
end
-
+
describe "setting the revision property" do
before do
@revision = '6aa99e9b3ab1'
diff --git a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb b/spec/unit/puppet/provider/vcsrepo/svn_spec.rb
index 5c27818..d360433 100644
--- a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/svn_spec.rb
@@ -11,7 +11,7 @@ describe_provider :vcsrepo, :svn, :resource => {:path => '/tmp/vcsrepo'} do
resource.value(:source),
resource.value(:path))
provider.create
- end
+ end
end
resource_without :revision do
it "should just execute 'svn checkout' without a revision" do
@@ -19,7 +19,7 @@ describe_provider :vcsrepo, :svn, :resource => {:path => '/tmp/vcsrepo'} do
resource.value(:source),
resource.value(:path))
provider.create
- end
+ end
end
end
resource_without :source do
@@ -63,7 +63,7 @@ describe_provider :vcsrepo, :svn, :resource => {:path => '/tmp/vcsrepo'} do
provider.revision.should == '3' # From 'Last Changed Rev', not 'Revision'
end
end
-
+
describe "setting the revision property" do
before do
@revision = '30'