From 7c72db9a26fc0e1b763963090ccdfdc529242a95 Mon Sep 17 00:00:00 2001 From: Pete Higgins Date: Wed, 29 Jul 2020 16:49:31 -0700 Subject: Remove unused shared context that conflicted with cheffish. Signed-off-by: Pete Higgins --- .../shared/integration/integration_helper.rb | 51 ++++++++++------------ 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/spec/support/shared/integration/integration_helper.rb b/spec/support/shared/integration/integration_helper.rb index 27233ff482..41f2b46995 100644 --- a/spec/support/shared/integration/integration_helper.rb +++ b/spec/support/shared/integration/integration_helper.rb @@ -44,7 +44,29 @@ module IntegrationSupport def when_the_repository(desc, *tags, &block) context("when the chef repo #{desc}", *tags) do - include_context "with a chef repo" + before :each do + raise "Can only create one directory per test" if @repository_dir + + @repository_dir = Dir.mktmpdir("chef_repo") + Chef::Config.chef_repo_path = @repository_dir + %w{client cookbook data_bag environment node role user}.each do |object_name| + Chef::Config.delete("#{object_name}_path".to_sym) + end + end + + after :each do + if @repository_dir + begin + # TODO: "force" actually means "silence all exceptions". this + # silences a weird permissions error on Windows that we should track + # down, but for now there's no reason for it to blow up our CI. + FileUtils.remove_entry_secure(@repository_dir, force = ChefUtils.windows?) + ensure + @repository_dir = nil + end + end + Dir.chdir(@old_cwd) if @old_cwd + end module_eval(&block) end @@ -98,31 +120,4 @@ module IntegrationSupport @old_cwd = Dir.pwd Dir.chdir(path_to(relative_path)) end - - RSpec.shared_context "with a chef repo" do - before :each do - raise "Can only create one directory per test" if @repository_dir - - @repository_dir = Dir.mktmpdir("chef_repo") - Chef::Config.chef_repo_path = @repository_dir - %w{client cookbook data_bag environment node role user}.each do |object_name| - Chef::Config.delete("#{object_name}_path".to_sym) - end - end - - after :each do - if @repository_dir - begin - # TODO: "force" actually means "silence all exceptions". this - # silences a weird permissions error on Windows that we should track - # down, but for now there's no reason for it to blow up our CI. - FileUtils.remove_entry_secure(@repository_dir, force = ChefUtils.windows?) - ensure - @repository_dir = nil - end - end - Dir.chdir(@old_cwd) if @old_cwd - end - - end end -- cgit v1.2.1