diff options
-rwxr-xr-x | spec/functional/resource/aix_service_spec.rb | 4 | ||||
-rwxr-xr-x | spec/functional/resource/aixinit_service_spec.rb | 1 | ||||
-rw-r--r-- | spec/functional/resource/bff_spec.rb | 1 | ||||
-rw-r--r-- | spec/functional/resource/cron_spec.rb | 10 | ||||
-rw-r--r-- | spec/functional/resource/ifconfig_spec.rb | 10 | ||||
-rw-r--r-- | spec/functional/resource/link_spec.rb | 8 | ||||
-rw-r--r-- | spec/functional/resource/mount_spec.rb | 11 | ||||
-rw-r--r-- | spec/functional/resource/msu_package_spec.rb | 7 |
8 files changed, 40 insertions, 12 deletions
diff --git a/spec/functional/resource/aix_service_spec.rb b/spec/functional/resource/aix_service_spec.rb index 0db0ab2385..ba86ddec31 100755 --- a/spec/functional/resource/aix_service_spec.rb +++ b/spec/functional/resource/aix_service_spec.rb @@ -79,6 +79,10 @@ describe Chef::Resource::Service, :requires_root, :aix_only do shell_out("id -u #{ENV["USER"]}").stdout.chomp end + let(:run_context) do + Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new) + end + describe "When service is a subsystem" do before(:all) do script_dir = File.join(File.dirname(__FILE__), "/../assets/") diff --git a/spec/functional/resource/aixinit_service_spec.rb b/spec/functional/resource/aixinit_service_spec.rb index 0b69c9d9a5..bb89277e40 100755 --- a/spec/functional/resource/aixinit_service_spec.rb +++ b/spec/functional/resource/aixinit_service_spec.rb @@ -56,6 +56,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do # Actual tests let(:new_resource) do + run_context = Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new) new_resource = Chef::Resource::Service.new("chefinittest", run_context) new_resource.provider Chef::Provider::Service::AixInit new_resource.supports({ status: true, restart: true, reload: true }) diff --git a/spec/functional/resource/bff_spec.rb b/spec/functional/resource/bff_spec.rb index 32358b4c39..ad45552c16 100644 --- a/spec/functional/resource/bff_spec.rb +++ b/spec/functional/resource/bff_spec.rb @@ -23,6 +23,7 @@ describe Chef::Resource::BffPackage, :requires_root, external: ohai[:platform] ! include Chef::Mixin::ShellOut let(:new_resource) do + run_context = Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new) new_resource = Chef::Resource::BffPackage.new(@pkg_name, run_context) new_resource.source @pkg_path new_resource diff --git a/spec/functional/resource/cron_spec.rb b/spec/functional/resource/cron_spec.rb index 932bef4a42..131fa89ba5 100644 --- a/spec/functional/resource/cron_spec.rb +++ b/spec/functional/resource/cron_spec.rb @@ -52,6 +52,16 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do end # Actual tests + + let(:run_context) do + node = Chef::Node.new + node.default[:platform] = ohai[:platform] + node.default[:platform_version] = ohai[:platform_version] + node.default[:os] = ohai[:os] + events = Chef::EventDispatch::Dispatcher.new + Chef::RunContext.new(node, {}, events) + end + let(:new_resource) do run_context = Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new) diff --git a/spec/functional/resource/ifconfig_spec.rb b/spec/functional/resource/ifconfig_spec.rb index 70ae0f0703..127e4e6331 100644 --- a/spec/functional/resource/ifconfig_spec.rb +++ b/spec/functional/resource/ifconfig_spec.rb @@ -25,8 +25,16 @@ include_flag = !(%w{amazon debian aix}.include?(ohai[:platform_family]) || (ohai describe Chef::Resource::Ifconfig, :requires_root, :requires_ifconfig, external: include_flag do include Chef::Mixin::ShellOut + let(:run_context) do + node = Chef::Node.new + node.default[:platform] = ohai[:platform] + node.default[:platform_version] = ohai[:platform_version] + node.default[:os] = ohai[:os] + events = Chef::EventDispatch::Dispatcher.new + Chef::RunContext.new(node, {}, events) + end + let(:new_resource) do - run_context = Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new) new_resource = Chef::Resource::Ifconfig.new("10.10.0.1", run_context) new_resource end diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb index ecceb84a52..c9177ebc77 100644 --- a/spec/functional/resource/link_spec.rb +++ b/spec/functional/resource/link_spec.rb @@ -64,14 +64,10 @@ describe Chef::Resource::Link do end end - def node + def user(user) node = Chef::Node.new node.consume_external_attrs(ohai.data, {}) - node - end - - def user(user) - run_context = Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new) + run_context = Chef::RunContext.new(node, {}, Chef::EventDispatch::Dispatcher.new) usr = Chef::Resource.resource_for_node(:user, node).new(user, run_context) usr.password("ComplexPass11!") if windows? usr diff --git a/spec/functional/resource/mount_spec.rb b/spec/functional/resource/mount_spec.rb index 2b8a11a339..55738a4326 100644 --- a/spec/functional/resource/mount_spec.rb +++ b/spec/functional/resource/mount_spec.rb @@ -100,9 +100,16 @@ describe Chef::Resource::Mount, :requires_root, external: include_flag do expect(shell_out("cat #{unix_mount_config_file}").stdout).not_to include("#{mount_point}:") end - let(:new_resource) do - run_context = Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new) + let(:run_context) do + node = Chef::Node.new + node.default[:platform] = ohai[:platform] + node.default[:platform_version] = ohai[:platform_version] + node.default[:os] = ohai[:os] + events = Chef::EventDispatch::Dispatcher.new + Chef::RunContext.new(node, {}, events) + end + let(:new_resource) do new_resource = Chef::Resource::Mount.new(@mount_point, run_context) new_resource.device @device new_resource.name @mount_point diff --git a/spec/functional/resource/msu_package_spec.rb b/spec/functional/resource/msu_package_spec.rb index 1161049571..723c95ed49 100644 --- a/spec/functional/resource/msu_package_spec.rb +++ b/spec/functional/resource/msu_package_spec.rb @@ -26,11 +26,12 @@ describe Chef::Resource::MsuPackage, :win2012r2_only do let(:package_identity) { "Package_for_KB2959977~31bf3856ad364e35~amd64~~6.3.1.1" } let(:timeout) { 3600 } + let(:run_context) do + Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new) + end + let(:new_resource) { Chef::Resource::CabPackage.new("windows_test_pkg") } let(:cab_provider) do - node = Chef::Node.new - events = Chef::EventDispatch::Dispatcher.new - run_context = Chef::RunContext.new(node, {}, events) Chef::Provider::Package::Cab.new(new_resource, run_context) end |