summaryrefslogtreecommitdiff
path: root/spec/functional/resource/cookbook_file_spec.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2014-07-29 17:14:24 -0700
committerdanielsdeleo <dan@getchef.com>2014-07-30 14:07:07 -0700
commit263f62774641bf32be6fd79d1d69022531fb3285 (patch)
tree4e7a541754dd2e81e64c8ca28f77360368062188 /spec/functional/resource/cookbook_file_spec.rb
parentfc3b0eed9b8b33bcb51121deee09314f9eb86622 (diff)
downloadchef-263f62774641bf32be6fd79d1d69022531fb3285.tar.gz
Make FileVendor configuration specific to the two implementations
FileVendor previously was configured by storing a closure/anonymous function as a class instance variable. This had the following downsides: * The API was too general, which caused a lot of code repetition * The block was lazily evaluated, which hid errors and made testing more difficult * The closures captured references to classes with references to large data structures, which complicates GC. Since we've only ever had the same two implementations of FileVendor, we can encapsulate configuration of the FileVendor factory by wrapping each configuration option in a method. As a side benefit, arguments to these methods will be eagerly evaluated, which makes it easier to detect errors.
Diffstat (limited to 'spec/functional/resource/cookbook_file_spec.rb')
-rw-r--r--spec/functional/resource/cookbook_file_spec.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/functional/resource/cookbook_file_spec.rb b/spec/functional/resource/cookbook_file_spec.rb
index 173dac8268..7797ed0041 100644
--- a/spec/functional/resource/cookbook_file_spec.rb
+++ b/spec/functional/resource/cookbook_file_spec.rb
@@ -40,7 +40,7 @@ describe Chef::Resource::CookbookFile do
# set up cookbook collection for this run to use, based on our
# spec data.
cookbook_repo = File.expand_path(File.join(CHEF_SPEC_DATA, 'cookbooks'))
- Chef::Cookbook::FileVendor.on_create { |manifest| Chef::Cookbook::FileSystemFileVendor.new(manifest, cookbook_repo) }
+ Chef::Cookbook::FileVendor.fetch_from_disk(cookbook_repo)
loader = Chef::CookbookLoader.new(cookbook_repo)
loader.load_cookbooks
cookbook_collection = Chef::CookbookCollection.new(loader)