1 require 'spec_helper_acceptance'
3 describe 'apt::pin define', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
5 it 'should work with no errors' do
8 apt::pin { 'vim-puppet': }
11 apply_manifest(pp, :catch_failures => true)
14 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
16 it { should contain 'Pin: release a=vim-puppet' }
22 it 'should work with no errors' do
25 apt::pin { 'vim-puppet': ensure => present }
28 apply_manifest(pp, :catch_failures => true)
31 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
33 it { should contain 'Pin: release a=vim-puppet' }
38 it 'should work with no errors' do
41 apt::pin { 'vim-puppet': ensure => absent }
44 apply_manifest(pp, :catch_failures => true)
47 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
48 it { should_not be_file }
55 it 'should work with no errors' do
58 apt::pin { 'vim-puppet':
64 apply_manifest(pp, :catch_failures => true)
67 describe file('/etc/apt/preferences.d/99-vim-puppet.pref') do
69 it { should contain 'Pin: release a=vim-puppet' }
76 it 'should work with no errors' do
79 apt::pin { 'vim-puppet':
85 apply_manifest(pp, :catch_failures => true)
88 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
90 it { should contain 'Package: test' }
91 it { should contain 'Pin: release a=vim-puppet' }
96 it 'should work with no errors' do
101 packages => ['apache', 'ntop'],
105 apply_manifest(pp, :catch_failures => true)
108 describe file('/etc/apt/preferences.d/array.pref') do
109 it { should be_file }
110 it { should contain 'Package: apache ntop' }
111 it { should contain 'Pin: release a=array' }
117 context 'testrelease' do
118 it 'should work with no errors' do
121 apt::pin { 'vim-puppet':
123 release => 'testrelease',
127 apply_manifest(pp, :catch_failures => true)
130 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
131 it { should be_file }
132 it { should contain 'Pin: release a=testrelease' }
138 context 'testrelease' do
139 it 'should work with no errors' do
142 apt::pin { 'vim-puppet':
144 origin => 'testrelease',
148 apply_manifest(pp, :catch_failures => true)
151 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
152 it { should be_file }
153 it { should contain 'Pin: origin testrelease' }
160 it 'should work with no errors' do
163 apt::pin { 'vim-puppet':
170 apply_manifest(pp, :catch_failures => true)
173 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
174 it { should be_file }
175 it { should contain 'Package: test' }
176 it { should contain 'Pin: version 1.0.0' }
181 context 'codename' do
182 context 'testname' do
183 it 'should work with no errors' do
186 apt::pin { 'vim-puppet':
188 codename => 'testname',
192 apply_manifest(pp, :catch_failures => true)
195 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
196 it { should be_file }
197 it { should contain 'Pin: release n=testname' }
202 context 'release_version' do
204 it 'should work with no errors' do
207 apt::pin { 'vim-puppet':
209 release_version => '1.1.1',
213 apply_manifest(pp, :catch_failures => true)
216 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
217 it { should be_file }
218 it { should contain 'Pin: release v=1.1.1' }
223 context 'component' do
224 context 'testcomponent' do
225 it 'should work with no errors' do
228 apt::pin { 'vim-puppet':
230 component => 'testcomponent',
234 apply_manifest(pp, :catch_failures => true)
237 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
238 it { should be_file }
239 it { should contain 'Pin: release c=testcomponent' }
244 context 'originator' do
245 context 'testorigin' do
246 it 'should work with no errors' do
249 apt::pin { 'vim-puppet':
251 originator => 'testorigin',
255 apply_manifest(pp, :catch_failures => true)
258 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
259 it { should be_file }
260 it { should contain 'Pin: release o=testorigin' }
266 context 'testlabel' do
267 it 'should work with no errors' do
270 apt::pin { 'vim-puppet':
272 label => 'testlabel',
276 apply_manifest(pp, :catch_failures => true)
279 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
280 it { should be_file }
281 it { should contain 'Pin: release l=testlabel' }