diff options
author | Martin Vidner <mvidner@suse.cz> | 2012-12-18 10:08:24 +0100 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2013-05-23 09:34:02 -0700 |
commit | 65e809546fcc6b3de5da586a5ac23e6a8b51b6e6 (patch) | |
tree | ec21789a9d393492c8b6564b31d13fc165a22338 | |
parent | b42cff228076edbfdf0dc14f479f799b91e606fc (diff) | |
download | chef-65e809546fcc6b3de5da586a5ac23e6a8b51b6e6.tar.gz |
CHEF-3705: rspec: Use local non-privileged paths.
When building as non-root and running rspec,
it would fail trying to create /var/chef.
-rw-r--r-- | chef-server-api/spec/spec_helper.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/chef-server-api/spec/spec_helper.rb b/chef-server-api/spec/spec_helper.rb index c6d59514cf..c94435ca62 100644 --- a/chef-server-api/spec/spec_helper.rb +++ b/chef-server-api/spec/spec_helper.rb @@ -19,6 +19,16 @@ require "rubygems" require "merb-core" require "rspec" +require "chef/config" +require "tmpdir" +require "fileutils" + +# Avoid system-wide directories we may not be able to access +fake_var_chef = Dir.mktmpdir("fake-var-chef") +at_exit { FileUtils.remove_entry_secure(fake_var_chef) } +Chef::Config[:file_cache_path] = "#{fake_var_chef}/cache" +Chef::Config[:cache_options][:path] = "#{fake_var_chef}/cache/checksums" +Chef::Config[:checksum_path] = "#{fake_var_chef}/checksums" Merb.push_path(:spec_helpers, "spec" / "spec_helpers", "**/*.rb") Merb.push_path(:spec_fixtures, "spec" / "fixtures", "**/*.rb") |