Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for custom source template to yum_repository
- Loading branch information
Sean OMeara
committed
Feb 13, 2014
1 parent
69bd248
commit e576d3e
Showing
6 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
require 'spec_helper' | ||
|
||
describe 'yum_test::test_repository_eight' do | ||
let(:test_repository_eight_run) do | ||
ChefSpec::Runner.new( | ||
:step_into => 'yum_repository' | ||
).converge(described_recipe) | ||
end | ||
|
||
let(:test_repository_eight_template) do | ||
test_repository_eight_run.template('/etc/yum.repos.d/test8.repo') | ||
end | ||
|
||
let(:test_repository_eight_content) do | ||
'Hello there, I am a custom template. | ||
baseurl: http://drop.the.baseurl.biz | ||
Have a nice day. | ||
' | ||
end | ||
|
||
context 'creating a yum_repository with minimal parameters' do | ||
it 'creates yum_repository[test8]' do | ||
expect(test_repository_eight_run).to create_yum_repository('test8') | ||
end | ||
|
||
it 'steps into yum_repository and creates template[/etc/yum.repos.d/test8.repo]' do | ||
expect(test_repository_eight_run).to create_template('/etc/yum.repos.d/test8.repo') | ||
end | ||
|
||
it 'steps into yum_repository and renders file[/etc/yum.repos.d/test8.repo]' do | ||
expect(test_repository_eight_run).to render_file('/etc/yum.repos.d/test8.repo').with_content(test_repository_eight_content) | ||
end | ||
|
||
it 'steps into yum_repository and runs execute[yum-makecache-test8]' do | ||
expect(test_repository_eight_run).to_not run_execute('yum-makecache-test8') | ||
end | ||
|
||
it 'steps into yum_repository and runs ruby_block[yum-cache-reload-test8]' do | ||
expect(test_repository_eight_run).to_not run_ruby_block('yum-cache-reload-test8') | ||
end | ||
|
||
it 'sends a :run to execute[yum-makecache-test8]' do | ||
expect(test_repository_eight_template).to notify('execute[yum-makecache-test8]') | ||
end | ||
|
||
it 'sends a :create to ruby_block[yum-cache-reload-test8]' do | ||
expect(test_repository_eight_template).to notify('ruby_block[yum-cache-reload-test8]') | ||
end | ||
end | ||
|
||
end |
7 changes: 7 additions & 0 deletions
7
test/fixtures/cookbooks/yum_test/recipes/test_repository_eight.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# The simplest case | ||
yum_repository 'test8' do | ||
source 'custom_template.erb' | ||
description 'an test' | ||
baseurl 'http://drop.the.baseurl.biz' | ||
action :create | ||
end |
3 changes: 3 additions & 0 deletions
3
test/fixtures/cookbooks/yum_test/templates/default/custom_template.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Hello there, I am a custom template. | ||
baseurl: <%= @config.baseurl %> | ||
Have a nice day. |