summaryrefslogtreecommitdiff
path: root/spec/unit/provider/template
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/unit/provider/template
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/unit/provider/template')
-rw-r--r--spec/unit/provider/template/content_spec.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/unit/provider/template/content_spec.rb b/spec/unit/provider/template/content_spec.rb
index dfc5d21c2a..b419e70519 100644
--- a/spec/unit/provider/template/content_spec.rb
+++ b/spec/unit/provider/template/content_spec.rb
@@ -36,7 +36,7 @@ describe Chef::Provider::Template::Content do
let(:run_context) do
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)
cl = Chef::CookbookLoader.new(cookbook_repo)
cl.load_cookbooks
cookbook_collection = Chef::CookbookCollection.new(cl)