Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update for chefspec 0.9.0

- Add include_recipe example
- Update node attr set code to be compatible with the upcoming chef 11 release
  • Loading branch information...
commit 58cf9226872f6817743c1785b91c5a09e18e94d7 1 parent c8c0e98
Jim Hopp authored
2  Gemfile
View
@@ -1,4 +1,4 @@
# A sample Gemfile
source "http://rubygems.org"
-gem "chefspec", "~>0.8"
+gem "chefspec", "~>0.9"
18 Gemfile.lock
View
@@ -1,9 +1,9 @@
GEM
remote: http://rubygems.org/
specs:
- builder (3.1.3)
+ builder (3.1.4)
bunny (0.7.9)
- chef (10.14.2)
+ chef (10.16.2)
bunny (>= 0.6.0, < 0.8.0)
erubis
highline (>= 1.6.9)
@@ -21,12 +21,12 @@ GEM
treetop (~> 1.4.9)
uuidtools
yajl-ruby (~> 1.1)
- chefspec (0.8.0)
+ chefspec (0.9.0)
chef (>= 0.9.12)
erubis
minitest-chef-handler (~> 0.6.0)
rspec (~> 2.11.0)
- ci_reporter (1.7.2)
+ ci_reporter (1.7.3)
builder (>= 2.1.2)
diff-lcs (1.1.3)
erubis (2.7.0)
@@ -34,8 +34,8 @@ GEM
ipaddress (0.8.0)
json (1.6.1)
mime-types (1.19)
- minitest (3.4.0)
- minitest-chef-handler (0.6.1)
+ minitest (4.2.0)
+ minitest-chef-handler (0.6.3)
chef
ci_reporter
minitest
@@ -69,9 +69,9 @@ GEM
rspec-core (2.11.1)
rspec-expectations (2.11.3)
diff-lcs (~> 1.1.3)
- rspec-mocks (2.11.2)
+ rspec-mocks (2.11.3)
systemu (2.5.2)
- treetop (1.4.10)
+ treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
uuidtools (2.1.3)
@@ -81,4 +81,4 @@ PLATFORMS
ruby
DEPENDENCIES
- chefspec (~> 0.8)
+ chefspec (~> 0.9)
2  cookbooks/mytestcookbook/recipes/include_recipes.rb
View
@@ -0,0 +1,2 @@
+
+include_recipe "mytestcookbook::included_recipe"
2  cookbooks/mytestcookbook/recipes/included_recipe.rb
View
@@ -0,0 +1,2 @@
+
+log "this is an included recipe"
2  cookbooks/mytestcookbook/spec/attr_tests_spec.rb
View
@@ -9,7 +9,7 @@
end
it 'can set values for default attributes' do
runner = ChefSpec::ChefRunner.new do |node|
- node["mytestcookbook"] = { :attr_a => 'bar' }
+ node.set["mytestcookbook"] = { :attr_a => 'bar' }
end
runner.converge 'mytestcookbook::default'
runner.node.mytestcookbook.attr_a.should eq 'bar'
9 cookbooks/mytestcookbook/spec/include_recipe_spec.rb
View
@@ -0,0 +1,9 @@
+require 'bundler/setup'
+require 'chefspec'
+
+describe 'include_recipe tests' do
+ let (:chef_run) { ChefSpec::ChefRunner.new.converge 'mytestcookbook::include_recipes' }
+ it 'includes another recipe' do
+ chef_run.should include_recipe 'mytestcookbook::included_recipe'
+ end
+end
4 cookbooks/mytestcookbook/spec/lwrp_spec.rb
View
@@ -6,7 +6,7 @@
runner = ChefSpec::ChefRunner.new(:step_into => ['mytestcookbook_manage'])
}
let(:chef_run) {
- runner.node["mytestcookbook"] = { :cmd => 'echo "adios"' }
+ runner.node.set["mytestcookbook"] = { :cmd => 'echo "adios"' }
runner.converge 'mytestcookbook::lwrp'
}
it 'should install foo' do
@@ -14,7 +14,7 @@
end
it 'executes stuff' do
cmd = 'echo "hello!"'
- runner.node["mytestcookbook"] = { :cmd => cmd }
+ runner.node.set["mytestcookbook"] = { :cmd => cmd }
runner.converge 'mytestcookbook::lwrp'
runner.should execute_command cmd
end
Please sign in to comment.
Something went wrong with that request. Please try again.