diff options
author | John Keiser <john@johnkeiser.com> | 2016-08-23 10:47:57 -0700 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2016-08-23 10:47:57 -0700 |
commit | 0c394b5b00303528b66d390d3a945d263ce54eda (patch) | |
tree | 29c9704bdf88e6318ece4634d33d6d79fd87c848 | |
parent | 44202823615dc28de4c9c4a34ae63eed047ac3b1 (diff) | |
download | chef-jk/no-dup-context.tar.gz |
Don't dup the Cheffish "with a chef repo" contextjk/no-dup-context
-rw-r--r-- | spec/support/shared/integration/integration_helper.rb | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/spec/support/shared/integration/integration_helper.rb b/spec/support/shared/integration/integration_helper.rb index 29f2eef50f..839900ebf4 100644 --- a/spec/support/shared/integration/integration_helper.rb +++ b/spec/support/shared/integration/integration_helper.rb @@ -64,41 +64,6 @@ module IntegrationSupport Chef::ServerAPI.new end - def directory(relative_path, &block) - old_parent_path = @parent_path - @parent_path = path_to(relative_path) - FileUtils.mkdir_p(@parent_path) - instance_eval(&block) if block - @parent_path = old_parent_path - end - - def file(relative_path, contents) - filename = path_to(relative_path) - dir = File.dirname(filename) - FileUtils.mkdir_p(dir) unless dir == "." - File.open(filename, "w") do |file| - raw = case contents - when Hash, Array - Chef::JSONCompat.to_json_pretty(contents) - else - contents - end - file.write(raw) - end - end - - def symlink(relative_path, relative_dest) - filename = path_to(relative_path) - dir = File.dirname(filename) - FileUtils.mkdir_p(dir) unless dir == "." - dest_filename = path_to(relative_dest) - File.symlink(dest_filename, filename) - end - - def path_to(relative_path) - File.expand_path(relative_path, (@parent_path || @repository_dir)) - end - def cb_metadata(name, version, extra_text = "") "name #{name.inspect}; version #{version.inspect}#{extra_text}" end @@ -108,36 +73,6 @@ module IntegrationSupport 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 - %w{client cookbook data_bag environment node role user}.each do |object_name| - Chef::Config.delete("#{object_name}_path".to_sym) - end - Chef::Config.delete(:chef_repo_path) - # 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 = Chef::Platform.windows?) - ensure - @repository_dir = nil - end - end - Dir.chdir(@old_cwd) if @old_cwd - end - - end - # Versioned cookbooks RSpec.shared_context "with versioned cookbooks", :versioned_cookbooks => true do |