-
-
Save petecheslock/999de67d5620e811a20c 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
chefspec | (cd recipe && bundle exec rspec --color --format documentation) | |
chefspec | recipe::default | |
chefspec | creates file | |
chefspec | has proper modes | |
chefspec | should include correct content | |
chefspec | Failures: | |
chefspec | 1) recipe::default should include correct content | |
chefspec | Failure/Error: @chef_run.should create_file_with_content @file, | |
chefspec | NameError: | |
chefspec | undefined local variable or method `node' for #<Erubis::Context:0x007fccc30b9bf8> | |
chefspec | # (erubis):3:in `block in evaluate' | |
chefspec | # ./spec/default_spec.rb:20:in `block (2 levels) in <top (required)>' | |
chefspec | Finished in 0.02112 seconds | |
chefspec | 3 examples, 1 failure | |
chefspec | Failed examples: | |
chefspec | rspec ./spec/default_spec.rb:19 # recipe::default should include correct key | |
chefspec | Terminated with a non-zero exit status. Strainer assumes this is a failure. | |
chefspec | FAILURE! |
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
template node["foo"]["bar"] do | |
source "script.sh.erb" | |
mode 00775 | |
end |
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
require 'spec_helper' | |
describe 'recipe::default' do | |
before do | |
@file = '/path/to/my/file' | |
@chef_run = ChefSpec::ChefRunner.new(platform: 'ubuntu', version: '12.04').converge('recipe::default') | |
end | |
it 'creates file' do | |
@chef_run.template create_file(@file) | |
end | |
it 'has proper modes' do | |
m = @chef_run.template(@file).mode | |
sprintf("%o", m).should == "775" | |
end | |
it 'should include correct content' do | |
@chef_run.should create_file_with_content @file, | |
"stuff_that_should_be_in_file" | |
end | |
end |
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
Static content in my file | |
Below is something driven by a node attribute | |
<%= node["foo"]["bar"]["baz"] %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment