summaryrefslogtreecommitdiff
path: root/spec/unit/provider/package_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/unit/provider/package_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/unit/provider/package_spec.rb')
-rw-r--r--spec/unit/provider/package_spec.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/unit/provider/package_spec.rb b/spec/unit/provider/package_spec.rb
index 33b4f8186a..375a0d0646 100644
--- a/spec/unit/provider/package_spec.rb
+++ b/spec/unit/provider/package_spec.rb
@@ -339,7 +339,7 @@ describe Chef::Provider::Package do
describe "when given a response file" 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)