summaryrefslogtreecommitdiff
path: root/spec/acceptance/create_repo_spec.rb
diff options
context:
space:
mode:
authorPhil Pham <phil.pham@puppetlabs.com>2014-02-14 11:16:15 -0800
committerPhil Pham <phil.pham@puppetlabs.com>2014-04-02 15:39:23 -0700
commit1ebe52ef9963391f13b406c843c8f475668f173c (patch)
tree56ceac2d54a525989a16847d17c3c2c6858027b9 /spec/acceptance/create_repo_spec.rb
parent92743c459ec7064c260bbf0686a368182291e99c (diff)
add beaker-rspec support
This adds support for beaker-rspec as well as basic test coverage for git
Diffstat (limited to 'spec/acceptance/create_repo_spec.rb')
-rw-r--r--spec/acceptance/create_repo_spec.rb77
1 files changed, 77 insertions, 0 deletions
diff --git a/spec/acceptance/create_repo_spec.rb b/spec/acceptance/create_repo_spec.rb
new file mode 100644
index 0000000..675517e
--- /dev/null
+++ b/spec/acceptance/create_repo_spec.rb
@@ -0,0 +1,77 @@
+require 'spec_helper_acceptance'
+
+tmpdir = default.tmpdir('vcsrepo')
+
+describe 'create a repo' do
+ context 'without a source' do
+ it 'creates a blank repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_blank_repo":
+ ensure => present,
+ provider => 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}/testrepo_blank_repo/") do
+ it 'should have zero files' do
+ shell("ls -1 #{tmpdir}/testrepo_blank_repo | wc -l") do |r|
+ expect(r.stdout).to match(/^0\n$/)
+ end
+ end
+ end
+
+ describe file("#{tmpdir}/testrepo_blank_repo/.git") do
+ it { should be_directory }
+ end
+ end
+
+ context 'bare repo' do
+ it 'creates a bare repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_bare_repo":
+ ensure => bare,
+ provider => 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}/testrepo_bare_repo/config") do
+ it { should contain 'bare = true' }
+ end
+
+ describe file("#{tmpdir}/testrepo_bare_repo/.git") do
+ it { should_not be_directory }
+ end
+ end
+
+ context 'bare repo with a revision' do
+ it 'creates a bare repo' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/testrepo_bare_repo_rev":
+ ensure => bare,
+ provider => git,
+ revision => 'master',
+ }
+ EOS
+
+ apply_manifest(pp, :catch_failures => true)
+ end
+
+ describe file("#{tmpdir}/testrepo_bare_repo_rev/config") do
+ it { should contain 'bare = true' }
+ end
+
+ describe file("#{tmpdir}/testrepo_bare_repo_rev/.git") do
+ it { should_not be_directory }
+ end
+ end
+end