]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - 3rdparty/modules/staging/spec/defines/staging_deploy_spec.rb
add nanliu/staging to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / staging / spec / defines / staging_deploy_spec.rb
diff --git a/3rdparty/modules/staging/spec/defines/staging_deploy_spec.rb b/3rdparty/modules/staging/spec/defines/staging_deploy_spec.rb
new file mode 100644 (file)
index 0000000..2cfd330
--- /dev/null
@@ -0,0 +1,27 @@
+require 'spec_helper'
+describe 'staging::deploy', :type => :define do
+
+  # forcing a more sane caller_module_name to match real usage.
+  let(:facts) { { :caller_module_name => 'spec',
+                  :osfamily           => 'RedHat',
+                  :staging_http_get   => 'curl',
+                  :path               => '/usr/local/bin:/usr/bin:/bin', } }
+
+  describe 'when deploying tar.gz' do
+    let(:title) { 'sample.tar.gz' }
+    let(:params) { { :source => 'puppet:///modules/staging/sample.tar.gz',
+      :target => '/usr/local' } }
+
+    it {
+      should contain_file('/opt/staging')
+      should contain_file('/opt/staging/spec/sample.tar.gz')
+      should contain_exec('extract sample.tar.gz').with({
+        :command => 'tar xzf /opt/staging/spec/sample.tar.gz',
+        :path    => '/usr/local/bin:/usr/bin:/bin',
+        :cwd     => '/usr/local',
+        :creates => '/usr/local/sample'
+      })
+    }
+  end
+
+end