diff options
author | Thom May <thom@chef.io> | 2018-03-22 14:16:25 +0000 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-03-26 10:31:10 -0700 |
commit | 1b81f35e023bcdc87e410c641545e849298de5c3 (patch) | |
tree | 67bbbe524d5e465da3748762320f4bf18fba77de /spec/unit | |
parent | 5242eef602dd9f00d030a51fbb2bee116b650113 (diff) | |
download | chef-1b81f35e023bcdc87e410c641545e849298de5c3.tar.gz |
ensure that providers inherit loggers from the run context
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/provider/cookbook_file_spec.rb | 3 | ||||
-rw-r--r-- | spec/unit/provider/file_spec.rb | 3 | ||||
-rw-r--r-- | spec/unit/provider/group/dscl_spec.rb | 8 | ||||
-rw-r--r-- | spec/unit/provider/package/homebrew_spec.rb | 3 | ||||
-rw-r--r-- | spec/unit/provider/registry_key_spec.rb | 8 | ||||
-rw-r--r-- | spec/unit/provider/remote_file_spec.rb | 3 | ||||
-rw-r--r-- | spec/unit/provider/template_spec.rb | 6 |
7 files changed, 19 insertions, 15 deletions
diff --git a/spec/unit/provider/cookbook_file_spec.rb b/spec/unit/provider/cookbook_file_spec.rb index f49cc7d3da..f27392de5d 100644 --- a/spec/unit/provider/cookbook_file_spec.rb +++ b/spec/unit/provider/cookbook_file_spec.rb @@ -25,7 +25,8 @@ require "support/shared/unit/provider/file" describe Chef::Provider::CookbookFile do let(:node) { double("Chef::Node") } let(:events) { double("Chef::Events").as_null_object } # mock all the methods - let(:run_context) { double("Chef::RunContext", :node => node, :events => events) } + let(:logger) { double("Mixlib::Log::Child").as_null_object } + let(:run_context) { double("Chef::RunContext", :node => node, :events => events, :logger => logger) } let(:enclosing_directory) do canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates"))) end diff --git a/spec/unit/provider/file_spec.rb b/spec/unit/provider/file_spec.rb index d8d4ed2286..fed9cd5ece 100644 --- a/spec/unit/provider/file_spec.rb +++ b/spec/unit/provider/file_spec.rb @@ -34,7 +34,8 @@ describe Chef::Provider::File do let(:node) { double("Chef::Node") } let(:events) { double("Chef::Events").as_null_object } # mock all the methods - let(:run_context) { double("Chef::RunContext", :node => node, :events => events) } + let(:logger) { double("Mixlib::Log::Child").as_null_object } + let(:run_context) { double("Chef::RunContext", :node => node, :events => events, :logger => logger) } let(:enclosing_directory) do canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates"))) end diff --git a/spec/unit/provider/group/dscl_spec.rb b/spec/unit/provider/group/dscl_spec.rb index cf3f0237f5..ebf57b097b 100644 --- a/spec/unit/provider/group/dscl_spec.rb +++ b/spec/unit/provider/group/dscl_spec.rb @@ -45,8 +45,7 @@ describe Chef::Provider::Group::Dscl do describe "safe_dscl" do before do - @node = Chef::Node.new - @provider = Chef::Provider::Group::Dscl.new(@node, @new_resource) + @provider = Chef::Provider::Group::Dscl.new(@new_resource, @run_context) allow(@provider).to receive(:dscl).and_return(["cmd", @status, "stdout", "stderr"]) end @@ -93,8 +92,7 @@ describe Chef::Provider::Group::Dscl do describe "get_free_gid" do before do - @node = Chef::Node.new - @provider = Chef::Provider::Group::Dscl.new(@node, @new_resource) + @provider = Chef::Provider::Group::Dscl.new(@new_resource, @run_context) allow(@provider).to receive(:safe_dscl).and_return("\naj 200\njt 201\n") end @@ -115,8 +113,6 @@ describe Chef::Provider::Group::Dscl do describe "gid_used?" do before do - @node = Chef::Node.new - @provider = Chef::Provider::Group::Dscl.new(@node, @new_resource) allow(@provider).to receive(:safe_dscl).and_return(<<-eos someprogram somethingElse:gid = ( 500 diff --git a/spec/unit/provider/package/homebrew_spec.rb b/spec/unit/provider/package/homebrew_spec.rb index 572c54e83d..833fa7bd3e 100644 --- a/spec/unit/provider/package/homebrew_spec.rb +++ b/spec/unit/provider/package/homebrew_spec.rb @@ -20,7 +20,8 @@ require "spec_helper" describe Chef::Provider::Package::Homebrew do let(:node) { Chef::Node.new } let(:events) { double("Chef::Events").as_null_object } - let(:run_context) { double("Chef::RunContext", node: node, events: events) } + let(:logger) { double("Mixlib::Log::Child").as_null_object } + let(:run_context) { double("Chef::RunContext", node: node, events: events, logger: logger) } let(:new_resource) { Chef::Resource::HomebrewPackage.new("emacs") } let(:current_resource) { Chef::Resource::HomebrewPackage.new("emacs") } diff --git a/spec/unit/provider/registry_key_spec.rb b/spec/unit/provider/registry_key_spec.rb index 3fb9468f5d..096fe9b9ed 100644 --- a/spec/unit/provider/registry_key_spec.rb +++ b/spec/unit/provider/registry_key_spec.rb @@ -313,7 +313,13 @@ describe Chef::Provider::RegistryKey do end describe Chef::Provider::RegistryKey, "key_missing?" do - let(:provider) { Chef::Provider::RegistryKey.new(nil, nil) } + let(:node) { Chef::Node.new } + let(:events) { double("Chef::Events").as_null_object } + let(:logger) { double("Mixlib::Log::Child").as_null_object } + let(:run_context) { double("Chef::RunContext", node: node, events: events, logger: logger) } + let(:new_resource) { Chef::Resource::RegistryKey.new("emacs") } + let(:provider) { Chef::Provider::RegistryKey.new(new_resource, run_context) } + let(:all_keys_present_in_all_hash) do [ { :name => "input1_value1", :type => :string, :data => "my_value1" }, { :name => "input1_value2", :type => :string, :data => "my_value2" }, diff --git a/spec/unit/provider/remote_file_spec.rb b/spec/unit/provider/remote_file_spec.rb index 6ceb1d450d..3f91377c60 100644 --- a/spec/unit/provider/remote_file_spec.rb +++ b/spec/unit/provider/remote_file_spec.rb @@ -36,7 +36,8 @@ describe Chef::Provider::RemoteFile do let(:node) { double("Chef::Node") } let(:events) { double("Chef::Events").as_null_object } # mock all the methods - let(:run_context) { double("Chef::RunContext", :node => node, :events => events) } + let(:logger) { double("Mixlib::Log::Child").as_null_object } + let(:run_context) { double("Chef::RunContext", :node => node, :events => events, :logger => logger) } let(:enclosing_directory) do canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates"))) end diff --git a/spec/unit/provider/template_spec.rb b/spec/unit/provider/template_spec.rb index 306fd6ea71..9f69772bc8 100644 --- a/spec/unit/provider/template_spec.rb +++ b/spec/unit/provider/template_spec.rb @@ -26,7 +26,8 @@ require "support/shared/unit/provider/file" describe Chef::Provider::Template do let(:node) { double("Chef::Node") } let(:events) { double("Chef::Events").as_null_object } # mock all the methods - let(:run_context) { double("Chef::RunContext", :node => node, :events => events) } + let(:logger) { double("Mixlib::Log::Child").as_null_object } + let(:run_context) { double("Chef::RunContext", :node => node, :events => events, :logger => logger) } let(:enclosing_directory) do canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates"))) end @@ -58,9 +59,6 @@ describe Chef::Provider::Template do context "when creating the template" do - let(:node) { double("Chef::Node") } - let(:events) { double("Chef::Events").as_null_object } # mock all the methods - let(:run_context) { double("Chef::RunContext", :node => node, :events => events) } let(:enclosing_directory) do canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates"))) end |