diff options
author | danielsdeleo <dan@getchef.com> | 2014-07-29 17:14:24 -0700 |
---|---|---|
committer | danielsdeleo <dan@getchef.com> | 2014-07-30 14:07:07 -0700 |
commit | 263f62774641bf32be6fd79d1d69022531fb3285 (patch) | |
tree | 4e7a541754dd2e81e64c8ca28f77360368062188 /spec/unit/mixin/template_spec.rb | |
parent | fc3b0eed9b8b33bcb51121deee09314f9eb86622 (diff) | |
download | chef-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/mixin/template_spec.rb')
-rw-r--r-- | spec/unit/mixin/template_spec.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/unit/mixin/template_spec.rb b/spec/unit/mixin/template_spec.rb index 3aa0b9ba22..63fa81782e 100644 --- a/spec/unit/mixin/template_spec.rb +++ b/spec/unit/mixin/template_spec.rb @@ -76,7 +76,7 @@ describe Chef::Mixin::Template, "render_template" do describe "with a template resource" do before :each 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) @node = Chef::Node.new cl = Chef::CookbookLoader.new(@cookbook_repo) |