From f4ba1a40058e7f3e1bc8e5b1880c9be312c57ca7 Mon Sep 17 00:00:00 2001 From: Matt Chu Date: Thu, 21 Aug 2014 14:12:42 -0700 Subject: [PATCH] add step_into during chefspec tests to correctly test custom resources --- spec/default_spec.rb | 7 +++++-- test/integration/default/serverspec/default_spec.rb | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/default_spec.rb b/spec/default_spec.rb index 3a87ff3..ae164df 100644 --- a/spec/default_spec.rb +++ b/spec/default_spec.rb @@ -6,7 +6,10 @@ context "on #{platform} #{version}" do let(:chef_run) do - ChefSpec::Runner.new(platform: platform, version: version) do |node| + ChefSpec::Runner.new( + platform: platform, + version: version, + step_into: [ 'anaconda_package' ]) do |node| #node.set['foo']['users'] = users end end @@ -26,7 +29,7 @@ expect(chef_run).to render_file(installer_config_path).with_content(/.*\n.*\n.*\n.*/) end - it 'exposes the conda_package resource' do + it 'exposes the anaconda_package resource' do chef_run.converge('recipe[anaconda::package_tests]') expect(chef_run).to install_conda_package('astroid') diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb index e599afa..8b84e52 100644 --- a/test/integration/default/serverspec/default_spec.rb +++ b/test/integration/default/serverspec/default_spec.rb @@ -11,7 +11,7 @@ describe 'general tests' do - it 'installs conda 2.0.1' do + it 'installs anaconda 2.0.1' do command('/opt/anaconda/2.0.1/bin/conda --version').should return_stdout 'conda 3.5.5' end