summaryrefslogtreecommitdiff
path: root/spec/unit/puppet/provider
diff options
context:
space:
mode:
authorMorgan Haskel <morgan@puppetlabs.com>2015-08-13 16:02:22 -0700
committerMorgan Haskel <morgan@puppetlabs.com>2015-08-14 15:32:10 -0700
commit14c05f5d6c589bebc9f93eb117105c14ce7be6f1 (patch)
treecc617704a9e302b92976ea72d0d9b07b462917bc /spec/unit/puppet/provider
parent5ef1b4740e1aab6672ee3971762c796c898ca639 (diff)
downloadpuppet-vcsrepo-14c05f5d6c589bebc9f93eb117105c14ce7be6f1.tar.gz
puppet-vcsrepo-14c05f5d6c589bebc9f93eb117105c14ce7be6f1.tar.bz2
MODULES-2125 - Allow revision to be passed without source
Will also work with empty repositories.
Diffstat (limited to 'spec/unit/puppet/provider')
-rw-r--r--spec/unit/puppet/provider/vcsrepo/git_spec.rb10
1 files changed, 9 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