Add puppet/archive module, required for newer puppet/rabbitmq
[mirror/dsa-puppet.git] / 3rdparty / modules / archive / spec / defines / artifactory_spec.rb
1 require 'spec_helper'
2
3 describe 'archive::artifactory' do
4   let(:facts) { { os: { family: 'RedHat' }, puppetversion: '4.4.0' } }
5
6   before do
7     MockFunction.new('artifactory_sha1') do |f|
8       f.stub.returns('0d4f4b4b039c10917cfc49f6f6be71e4')
9     end
10   end
11
12   context 'artifactory archive with defaults' do
13     let(:title) { '/opt/app/example.zip' }
14     let(:params) do
15       {
16         url: 'http://home.lan:8081/artifactory/path/example.zip'
17       }
18     end
19
20     it do
21       is_expected.to contain_archive('/opt/app/example.zip').with(
22         path: '/opt/app/example.zip',
23         source: 'http://home.lan:8081/artifactory/path/example.zip',
24         checksum: '0d4f4b4b039c10917cfc49f6f6be71e4',
25         checksum_type: 'sha1'
26       )
27     end
28
29     it do
30       is_expected.to contain_file('/opt/app/example.zip').with(
31         owner: '0',
32         group: '0',
33         mode: '0640',
34         require: 'Archive[/opt/app/example.zip]'
35       )
36     end
37   end
38
39   context 'artifactory archive with path' do
40     let(:title) { 'example.zip' }
41     let(:params) do
42       {
43         archive_path: '/opt/app',
44         url: 'http://home.lan:8081/artifactory/path/example.zip',
45         owner: 'app',
46         group: 'app',
47         mode: '0400'
48       }
49     end
50
51     it do
52       is_expected.to contain_archive('/opt/app/example.zip').with(
53         path: '/opt/app/example.zip',
54         source: 'http://home.lan:8081/artifactory/path/example.zip',
55         checksum: '0d4f4b4b039c10917cfc49f6f6be71e4',
56         checksum_type: 'sha1'
57       )
58     end
59
60     it do
61       is_expected.to contain_file('/opt/app/example.zip').with(
62         owner: 'app',
63         group: 'app',
64         mode: '0400',
65         require: 'Archive[/opt/app/example.zip]'
66       )
67     end
68   end
69 end