summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorTravis Fields <travis@puppetlabs.com>2014-05-15 16:47:24 -0700
committerTravis Fields <travis@puppetlabs.com>2014-05-15 16:47:24 -0700
commita213d71ec8d3e75bef909cc5c3f11aaea8b4e94d (patch)
tree2bad041921cdb5ea7219c149214b8c6f8b34fb94 /spec/unit
parentcfcd03a7c59eaa6b81de8c767bbd91e6d278c0f2 (diff)
Fix detached head state
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/puppet/provider/vcsrepo/git_spec.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
index ad6ed08..20aa084 100644
--- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
@@ -261,6 +261,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:git_provider) do
it "should use 'git fetch' and 'git reset'" do
resource[:revision] = 'feature/foo'
provider.expects(:update_submodules)
+ provider.expects(:git).with('branch','--list').returns("* master")
provider.expects(:git).with('branch', '-a').returns(resource.value(:revision))
provider.expects(:git).with('checkout', '--force', resource.value(:revision))
provider.expects(:git).with('branch', '-a').returns(resource.value(:revision))
@@ -272,6 +273,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:git_provider) do
it "should use 'git fetch' and 'git reset'" do
resource[:revision] = 'only/remote'
provider.expects(:update_submodules)
+ provider.expects(:git).with('branch','--list').returns("* master")
provider.expects(:git).with('branch', '-a').returns(resource.value(:revision))
provider.expects(:git).with('checkout', '--force', resource.value(:revision))
provider.expects(:git).with('branch', '-a').returns(resource.value(:revision))
@@ -341,7 +343,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:git_provider) do
context "retrieving the current revision" do
before do
expects_chdir
- provider.expects(:git).with('rev-parse', '--abbrev-ref', 'HEAD').returns("foo\n")
+ provider.expects(:git).with('branch','--list').returns("* foo")
end
it "will strip trailing newlines" do
@@ -377,19 +379,20 @@ describe Puppet::Type.type(:vcsrepo).provider(:git_provider) do
end
context 'on master' do
it do
- provider.expects(:git).with('rev-parse', '--abbrev-ref', 'HEAD').returns(fixture(:git_branch_a))
+ provider.expects(:git).with('branch','--list').returns("* master")
provider.latest.should == 'master'
end
end
context 'no branch' do
it do
- provider.expects(:git).with('rev-parse', '--abbrev-ref', 'HEAD').returns(fixture(:git_branch_none))
+ provider.expects(:git).with('branch','--list').returns("* master")
+
provider.latest.should == 'master'
end
end
context 'feature/bar' do
it do
- provider.expects(:git).with('rev-parse', '--abbrev-ref', 'HEAD').returns(fixture(:git_branch_feature_bar))
+ provider.expects(:git).with('branch','--list').returns("* master")
provider.latest.should == 'master'
end
end