summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/acceptance/clone_repo_spec.rb24
-rw-r--r--spec/spec_helper_acceptance.rb22
-rw-r--r--spec/unit/puppet/provider/vcsrepo/git_spec.rb2
3 files changed, 27 insertions, 21 deletions
diff --git a/spec/acceptance/clone_repo_spec.rb b/spec/acceptance/clone_repo_spec.rb
index 2cca061..c234550 100644
--- a/spec/acceptance/clone_repo_spec.rb
+++ b/spec/acceptance/clone_repo_spec.rb
@@ -38,6 +38,30 @@ describe 'clones a remote repo' do
end
end
+ context 'using a https source on github' do
+ it 'clones a repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/httpstestrepo":
+ ensure => present,
+ provider => git,
+ source => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git",
+ }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe file("#{tmpdir}/httpstestrepo/.git") do
+ it { is_expected.to be_directory }
+ end
+
+ describe file("#{tmpdir}/httpstestrepo/.git/HEAD") do
+ it { is_expected.to contain 'ref: refs/heads/master' }
+ end
+ end
+
context 'using a commit SHA' do
let (:sha) do
shell("git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1").stdout.chomp
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index 9ef826a..97c43e8 100644
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -1,25 +1,7 @@
require 'beaker-rspec'
+require 'beaker/puppet_install_helper'
-unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
- # This will install the latest available package on el and deb based
- # systems fail on windows and osx, and install via gem on other *nixes
- foss_opts = { :default_action => 'gem_install' }
-
- if default.is_pe?; then install_pe; else install_puppet( foss_opts ); end
-
- hosts.each do |host|
- unless host.is_pe?
- on hosts, "mkdir -p #{hosts.first['distmoduledir']}"
- end
-
- # We ask the host to interpolate it's distmoduledir because we don't
- # actually know it on Windows until we've let it redirect us (depending
- # on whether we're running as a 32/64 bit process on 32/64 bit Windows
- moduledir = on(host, "echo #{host['distmoduledir']}").stdout.chomp
- on host, "mkdir -p #{moduledir}"
- end
-end
-
+run_puppet_install_helper
RSpec.configure do |c|
# Project root
diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
index d33c98a..a240b50 100644
--- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
@@ -62,7 +62,7 @@ branches
resource[:depth] = 1
Dir.expects(:chdir).with('/').at_least_once.yields
Dir.expects(:chdir).with('/tmp/test').at_least_once.yields
- provider.expects(:git).with('clone', '--depth', '1', resource.value(:source), resource.value(:path))
+ provider.expects(:git).with('clone', '--depth', '1', '--branch', resource.value(:revision),resource.value(:source), resource.value(:path))
provider.expects(:update_submodules)
provider.expects(:update_remote_url).with("origin", resource.value(:source)).returns false
provider.expects(:git).with('branch', '-a').returns(branch_a_list(resource.value(:revision)))