1 require 'spec_helper_acceptance'
3 describe 'apt::pin define' 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' }
97 context 'testrelease' do
98 it 'should work with no errors' do
101 apt::pin { 'vim-puppet':
103 release => 'testrelease',
107 apply_manifest(pp, :catch_failures => true)
110 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
111 it { should be_file }
112 it { should contain 'Pin: release a=testrelease' }
118 context 'testrelease' do
119 it 'should work with no errors' do
122 apt::pin { 'vim-puppet':
124 origin => 'testrelease',
128 apply_manifest(pp, :catch_failures => true)
131 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
132 it { should be_file }
133 it { should contain 'Pin: origin "testrelease"' }
140 it 'should work with no errors' do
143 apt::pin { 'vim-puppet':
150 apply_manifest(pp, :catch_failures => true)
153 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
154 it { should be_file }
155 it { should contain 'Package: test' }
156 it { should contain 'Pin: version 1.0.0' }
161 context 'codename' do
162 context 'testname' do
163 it 'should work with no errors' do
166 apt::pin { 'vim-puppet':
168 codename => 'testname',
172 apply_manifest(pp, :catch_failures => true)
175 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
176 it { should be_file }
177 it { should contain 'Pin: release n=testname' }
182 context 'release_version' do
184 it 'should work with no errors' do
187 apt::pin { 'vim-puppet':
189 release_version => '1.1.1',
193 apply_manifest(pp, :catch_failures => true)
196 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
197 it { should be_file }
198 it { should contain 'Pin: release v=1.1.1' }
203 context 'component' do
204 context 'testcomponent' do
205 it 'should work with no errors' do
208 apt::pin { 'vim-puppet':
210 component => 'testcomponent',
214 apply_manifest(pp, :catch_failures => true)
217 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
218 it { should be_file }
219 it { should contain 'Pin: release c=testcomponent' }
224 context 'originator' do
225 context 'testorigin' do
226 it 'should work with no errors' do
229 apt::pin { 'vim-puppet':
231 originator => 'testorigin',
235 apply_manifest(pp, :catch_failures => true)
238 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
239 it { should be_file }
240 it { should contain 'Pin: release o=testorigin' }
246 context 'testlabel' do
247 it 'should work with no errors' do
250 apt::pin { 'vim-puppet':
252 label => 'testlabel',
256 apply_manifest(pp, :catch_failures => true)
259 describe file('/etc/apt/preferences.d/vim-puppet.pref') do
260 it { should be_file }
261 it { should contain 'Pin: release l=testlabel' }