summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-07-08 12:42:25 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2015-07-08 12:42:25 -0700
commit60af687362aa962b577450fff54b88ed21e8c713 (patch)
tree282939ed365be38a9a2cdeafb3c850df219524fd
parent33ff4450632a29199d8514b5083096d76d7b2a0e (diff)
parentedf525dbaeb54c384ed3fe5179dfa0ae630d5072 (diff)
downloadchef-60af687362aa962b577450fff54b88ed21e8c713.tar.gz
Merge pull request #3646 from chef/jdm/config-workstation-spec
Try fix for failing config test
-rw-r--r--chef-config/spec/unit/workstation_config_loader_spec.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/chef-config/spec/unit/workstation_config_loader_spec.rb b/chef-config/spec/unit/workstation_config_loader_spec.rb
index f247d1cac2..9f24a4f11b 100644
--- a/chef-config/spec/unit/workstation_config_loader_spec.rb
+++ b/chef-config/spec/unit/workstation_config_loader_spec.rb
@@ -236,12 +236,17 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
let(:config_content) { "" }
+ # We need to keep a reference to the tempfile because while #close does
+ # not unlink the file, the object being GC'd will.
+ let(:tempfile) do
+ Tempfile.new("Chef-WorkstationConfigLoader-rspec-test").tap do |t|
+ t.print(config_content)
+ t.close
+ end
+ end
+
let(:explicit_config_location) do
- # could use described_class, but remove all ':' from the path if so.
- t = Tempfile.new("Chef-WorkstationConfigLoader-rspec-test")
- t.print(config_content)
- t.close
- t.path
+ tempfile.path
end
after { File.unlink(explicit_config_location) if File.exist?(explicit_config_location) }