-
-
Save jjasghar/3aa254d70c7f1d07d414 to your computer and use it in GitHub Desktop.
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
# | |
# Cookbook Name:: Cookbook | |
# Spec:: default | |
# | |
require 'spec_helper' | |
describe 'cookbook::default' do | |
shared_examples_for :default_recipe do | |
it 'converges successfully' do | |
chef_run # This should not raise an error | |
end | |
end | |
context 'When all attributes are default, on an unspecified platform' do | |
let(:chef_run) do | |
runner = ChefSpec::ServerRunner.new | |
runner.converge(described_recipe) | |
end | |
it 'sets the default attributes correctly' do | |
expect(chef_run.node['cookbook']['feature1'].to eq(false) | |
end | |
it_behaves_like :default_recipe | |
end | |
context 'When all attributes are default, on RHEL-family platforms' do | |
let(:chef_run) do | |
runner = ChefSpec::ServerRunner.new(RHEL_OPTS) | |
runner.converge(described_recipe) | |
end | |
it_behaves_like :default_recipe | |
end | |
context 'When the feature1 attribute is true, on RHEL-family platforms' do | |
let(:chef_run) do | |
runner = ChefSpec::ServerRunner.new(RHEL_OPTS) | |
runner.node.set['cookbook']['feature1'] = true | |
runner.converge(described_recipe) | |
end | |
it_behaves_like :default_recipe | |
end | |
end |
Author
jjasghar
commented
Dec 15, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment