diff options
author | Pete Higgins <pete@peterhiggins.org> | 2020-07-29 16:49:31 -0700 |
---|---|---|
committer | Pete Higgins <pete@peterhiggins.org> | 2020-07-29 17:18:05 -0700 |
commit | 7c72db9a26fc0e1b763963090ccdfdc529242a95 (patch) | |
tree | 1b3a8a4ba867c8e3e197081db52a7276a56717d2 /spec | |
parent | f23f44dc5bf491a41a07ca77b297e24f635085ed (diff) | |
download | chef-7c72db9a26fc0e1b763963090ccdfdc529242a95.tar.gz |
Remove unused shared context that conflicted with cheffish.cleanup-integration-helper-code
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/support/shared/integration/integration_helper.rb | 51 |
1 files 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 |