Skip to content

Commit

Permalink
Add a test for duplicate File[] resources for the plugin parent dir
Browse files Browse the repository at this point in the history
Fixes #155
  • Loading branch information
R. Tyler Croy committed Sep 24, 2014
1 parent f555e88 commit 4774a5b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
1 change: 0 additions & 1 deletion manifests/plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
}

if (!defined(File[$plugin_dir])) {

if (!defined(File[$plugin_parent_dir])) {
file { $plugin_parent_dir:
ensure => directory,
Expand Down
19 changes: 17 additions & 2 deletions spec/defines/jenkins_plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,26 @@
describe 'jenkins::plugin' do
let(:title) { 'myplug' }

it { should contain_file('/var/lib/jenkins') }
it { should contain_file('/var/lib/jenkins/plugins') }
shared_examples 'manages plugins dirs' do
it { should contain_file('/var/lib/jenkins') }
it { should contain_file('/var/lib/jenkins/plugins') }
end

include_examples 'manages plugins dirs'
it { should contain_group('jenkins') }
it { should contain_user('jenkins').with('home' => '/var/lib/jenkins') }

context 'with my plugin parent directory already defined' do
let(:pre_condition) do
[
"file { '/var/lib/jenkins' : ensure => directory, }",
]
end

include_examples 'manages plugins dirs'
end


describe 'without version' do
it { should contain_exec('download-myplug').with(
:command => 'rm -rf myplug myplug.* && wget --no-check-certificate http://updates.jenkins-ci.org/latest/myplug.hpi',
Expand Down

0 comments on commit 4774a5b

Please sign in to comment.