summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chef-config/lib/chef-config/config.rb2
-rw-r--r--lib/chef/api_client/registration.rb4
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/repository/directory.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/file_system_entry.rb2
-rw-r--r--lib/chef/environment.rb4
-rw-r--r--lib/chef/knife/bootstrap.rb4
-rw-r--r--lib/chef/knife/cookbook_download.rb2
-rw-r--r--lib/chef/knife/cookbook_metadata.rb2
-rw-r--r--lib/chef/knife/core/hashed_command_loader.rb4
-rw-r--r--lib/chef/knife/exec.rb4
-rw-r--r--lib/chef/provider/service/arch.rb2
-rw-r--r--lib/chef/provider/service/debian.rb2
-rw-r--r--lib/chef/provider/service/gentoo.rb4
-rw-r--r--lib/chef/provider/service/macosx.rb4
-rw-r--r--lib/chef/provider/service/openbsd.rb2
-rw-r--r--lib/chef/provider/service/redhat.rb4
-rw-r--r--lib/chef/provider/service/upstart.rb2
-rw-r--r--lib/chef/resource/sudo.rb2
-rw-r--r--lib/chef/role.rb4
-rw-r--r--lib/chef/shell.rb2
-rw-r--r--lib/chef/util/diff.rb2
-rw-r--r--lib/chef/util/powershell/cmdlet.rb2
-rw-r--r--lib/chef/win32/file.rb4
-rwxr-xr-xspec/functional/resource/aixinit_service_spec.rb14
-rw-r--r--spec/functional/resource/bff_spec.rb4
-rw-r--r--spec/functional/resource/cookbook_file_spec.rb2
-rw-r--r--spec/functional/resource/dsc_resource_spec.rb2
-rw-r--r--spec/functional/resource/insserv_spec.rb8
-rw-r--r--spec/functional/resource/link_spec.rb24
-rw-r--r--spec/functional/resource/rpm_spec.rb4
-rw-r--r--spec/functional/resource/windows_certificate_spec.rb6
-rw-r--r--spec/functional/win32/service_manager_spec.rb2
-rw-r--r--spec/integration/recipes/lwrp_inline_resources_spec.rb2
-rw-r--r--spec/spec_helper.rb2
-rw-r--r--spec/support/platform_helpers.rb6
-rw-r--r--spec/support/platforms/win32/spec_service.rb2
-rw-r--r--spec/support/shared/functional/directory_resource.rb2
-rw-r--r--spec/support/shared/functional/execute_resource.rb2
-rw-r--r--spec/support/shared/functional/file_resource.rb4
-rw-r--r--spec/support/shared/functional/win32_service.rb2
-rw-r--r--spec/support/shared/functional/windows_script.rb6
-rw-r--r--spec/unit/environment_spec.rb14
-rw-r--r--spec/unit/knife/bootstrap_spec.rb28
-rw-r--r--spec/unit/knife/cookbook_download_spec.rb8
-rw-r--r--spec/unit/knife/cookbook_metadata_from_file_spec.rb2
-rw-r--r--spec/unit/knife/core/hashed_command_loader_spec.rb6
-rw-r--r--spec/unit/knife/supermarket_share_spec.rb2
-rw-r--r--spec/unit/provider/service/arch_service_spec.rb5
-rw-r--r--spec/unit/provider/service/debian_service_spec.rb2
-rw-r--r--spec/unit/provider/service/gentoo_service_spec.rb14
-rw-r--r--spec/unit/provider/service/macosx_spec.rb6
-rw-r--r--spec/unit/provider/service/redhat_spec.rb4
-rw-r--r--spec/unit/provider/service/upstart_service_spec.rb6
-rw-r--r--spec/unit/role_spec.rb22
57 files changed, 145 insertions, 144 deletions
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index 65a24d0ccc..ee25df6954 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -355,7 +355,7 @@ module ChefConfig
#
# @param path [String]
def self.path_accessible?(path)
- File.exists?(path) && File.readable?(path) && File.writable?(path)
+ File.exist?(path) && File.readable?(path) && File.writable?(path)
end
# Where cookbook files are stored on the server (by content checksum)
diff --git a/lib/chef/api_client/registration.rb b/lib/chef/api_client/registration.rb
index 02b7258fba..b05a2852a8 100644
--- a/lib/chef/api_client/registration.rb
+++ b/lib/chef/api_client/registration.rb
@@ -72,14 +72,14 @@ class Chef
def assert_destination_writable!
abs_path = File.expand_path(destination)
- unless File.exists?(File.dirname(abs_path))
+ unless File.exist?(File.dirname(abs_path))
begin
FileUtils.mkdir_p(File.dirname(abs_path))
rescue Errno::EACCES
raise Chef::Exceptions::CannotWritePrivateKey, "I can't create the configuration directory at #{File.dirname(abs_path)} - check permissions?"
end
end
- if (File.exists?(abs_path) && !File.writable?(abs_path)) || !File.writable?(File.dirname(abs_path))
+ if (File.exist?(abs_path) && !File.writable?(abs_path)) || !File.writable?(File.dirname(abs_path))
raise Chef::Exceptions::CannotWritePrivateKey, "I can't write your private key to #{abs_path} - check permissions?"
end
end
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb
index 81fcb6801c..0bb1ba1cac 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb
@@ -76,7 +76,7 @@ class Chef
# Write out .uploaded-cookbook-version.json
# cookbook_file_path = File.join(file_path, cookbook_name) <- this should be the same as self.file_path
- unless File.exists?(file_path)
+ unless File.exist?(file_path)
FileUtils.mkdir_p(file_path)
end
uploaded_cookbook_version_path = File.join(file_path, Chef::Cookbook::CookbookVersionLoader::UPLOADED_COOKBOOK_VERSION_FILE)
@@ -132,7 +132,7 @@ class Chef
end
def can_upload?
- File.exists?(uploaded_cookbook_version_path) || children.size > 0
+ File.exist?(uploaded_cookbook_version_path) || children.size > 0
end
protected
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
index 99deddae41..d01d24c360 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
@@ -137,7 +137,7 @@ class Chef
end
def exists?
- File.exists?(file_path) && (parent.nil? || parent.can_have_child?(name, dir?))
+ File.exist?(file_path) && (parent.nil? || parent.can_have_child?(name, dir?))
end
def read
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
index c384113a02..f7c00e7754 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
@@ -161,7 +161,7 @@ class Chef
# members.json and org.json may be found.
#
def root_dir
- existing_paths = root_paths.select { |path| File.exists?(path) }
+ existing_paths = root_paths.select { |path| File.exist?(path) }
if existing_paths.size > 0
MultiplexedDir.new(existing_paths.map do |path|
dir = FileSystemEntry.new(name, parent, path)
@@ -184,7 +184,7 @@ class Chef
return root_dir.child(name)
end
- paths = (child_paths[name] || []).select { |path| File.exists?(path) }
+ paths = (child_paths[name] || []).select { |path| File.exist?(path) }
if paths.size == 0
return NonexistentFSObject.new(name, self)
end
diff --git a/lib/chef/chef_fs/file_system/repository/directory.rb b/lib/chef/chef_fs/file_system/repository/directory.rb
index 8d227fd9d2..72a12d665f 100644
--- a/lib/chef/chef_fs/file_system/repository/directory.rb
+++ b/lib/chef/chef_fs/file_system/repository/directory.rb
@@ -151,7 +151,7 @@ class Chef
end
def exists?
- File.exists?(file_path)
+ File.exist?(file_path)
end
protected
diff --git a/lib/chef/chef_fs/file_system/repository/file_system_entry.rb b/lib/chef/chef_fs/file_system/repository/file_system_entry.rb
index 85f62d57ae..902bc63038 100644
--- a/lib/chef/chef_fs/file_system/repository/file_system_entry.rb
+++ b/lib/chef/chef_fs/file_system/repository/file_system_entry.rb
@@ -122,7 +122,7 @@ class Chef
end
def exists?
- File.exists?(file_path) && (parent.nil? || parent.can_have_child?(name, dir?))
+ File.exist?(file_path) && (parent.nil? || parent.can_have_child?(name, dir?))
end
def read
diff --git a/lib/chef/environment.rb b/lib/chef/environment.rb
index c121e37880..4f0c365443 100644
--- a/lib/chef/environment.rb
+++ b/lib/chef/environment.rb
@@ -254,11 +254,11 @@ class Chef
js_file = File.join(Chef::Config[:environment_path], "#{name}.json")
rb_file = File.join(Chef::Config[:environment_path], "#{name}.rb")
- if File.exists?(js_file)
+ if File.exist?(js_file)
# from_json returns object.class => json_class in the JSON.
hash = Chef::JSONCompat.parse(IO.read(js_file))
from_hash(hash)
- elsif File.exists?(rb_file)
+ elsif File.exist?(rb_file)
environment = Chef::Environment.new
environment.name(name)
environment.from_file(rb_file)
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb
index e48fd71194..a3f7d3a23c 100644
--- a/lib/chef/knife/bootstrap.rb
+++ b/lib/chef/knife/bootstrap.rb
@@ -480,7 +480,7 @@ class Chef
template = bootstrap_template
# Use the template directly if it's a path to an actual file
- if File.exists?(template)
+ if File.exist?(template)
Chef::Log.trace("Using the specified bootstrap template: #{File.dirname(template)}")
return template
end
@@ -495,7 +495,7 @@ class Chef
template_file = Array(bootstrap_files).find do |bootstrap_template|
Chef::Log.trace("Looking for bootstrap template in #{File.dirname(bootstrap_template)}")
- File.exists?(bootstrap_template)
+ File.exist?(bootstrap_template)
end
unless template_file
diff --git a/lib/chef/knife/cookbook_download.rb b/lib/chef/knife/cookbook_download.rb
index 6c567684af..a07b519511 100644
--- a/lib/chef/knife/cookbook_download.rb
+++ b/lib/chef/knife/cookbook_download.rb
@@ -73,7 +73,7 @@ class Chef
manifest = cookbook.cookbook_manifest
basedir = File.join(config[:download_directory], "#{@cookbook_name}-#{cookbook.version}")
- if File.exists?(basedir)
+ if File.exist?(basedir)
if config[:force]
Chef::Log.trace("Deleting #{basedir}")
FileUtils.rm_rf(basedir)
diff --git a/lib/chef/knife/cookbook_metadata.rb b/lib/chef/knife/cookbook_metadata.rb
index 3a55e8ba9e..8d8970b1c1 100644
--- a/lib/chef/knife/cookbook_metadata.rb
+++ b/lib/chef/knife/cookbook_metadata.rb
@@ -62,7 +62,7 @@ class Chef
def generate_metadata(cookbook)
Array(config[:cookbook_path]).reverse_each do |path|
file = File.expand_path(File.join(path, cookbook, "metadata.rb"))
- if File.exists?(file)
+ if File.exist?(file)
generate_metadata_from_file(cookbook, file)
else
validate_metadata_json(path, cookbook)
diff --git a/lib/chef/knife/core/hashed_command_loader.rb b/lib/chef/knife/core/hashed_command_loader.rb
index b88cededc0..c1d71f3edf 100644
--- a/lib/chef/knife/core/hashed_command_loader.rb
+++ b/lib/chef/knife/core/hashed_command_loader.rb
@@ -53,7 +53,7 @@ class Chef
paths = manifest[KEY]["plugins_paths"][command]
if paths && paths.is_a?(Array)
# It is only an error if all the paths don't exist
- if paths.all? { |sc| !File.exists?(sc) }
+ if paths.all? { |sc| !File.exist?(sc) }
errors[command] = paths
end
end
@@ -77,7 +77,7 @@ class Chef
false
else
paths.each do |sc|
- if File.exists?(sc)
+ if File.exist?(sc)
Kernel.load sc
else
return false
diff --git a/lib/chef/knife/exec.rb b/lib/chef/knife/exec.rb
index 77b10e6506..9286a91022 100644
--- a/lib/chef/knife/exec.rb
+++ b/lib/chef/knife/exec.rb
@@ -76,7 +76,7 @@ class Chef::Knife::Exec < Chef::Knife
def find_script(x)
# Try to find a script. First try expanding the path given.
script = File.expand_path(x)
- return script if File.exists?(script)
+ return script if File.exist?(script)
# Failing that, try searching the script path. If we can't find
# anything, fail gracefully.
@@ -86,7 +86,7 @@ class Chef::Knife::Exec < Chef::Knife
path = File.expand_path(path)
test = File.join(path, x)
Chef::Log.trace("Testing: #{test}")
- if File.exists?(test)
+ if File.exist?(test)
script = test
Chef::Log.trace("Found: #{test}")
return script
diff --git a/lib/chef/provider/service/arch.rb b/lib/chef/provider/service/arch.rb
index fe09baf2d5..400da506b1 100644
--- a/lib/chef/provider/service/arch.rb
+++ b/lib/chef/provider/service/arch.rb
@@ -32,7 +32,7 @@ class Chef::Provider::Service::Arch < Chef::Provider::Service::Init
end
def load_current_resource
- raise Chef::Exceptions::Service, "Could not find /etc/rc.conf" unless ::File.exists?("/etc/rc.conf")
+ raise Chef::Exceptions::Service, "Could not find /etc/rc.conf" unless ::File.exist?("/etc/rc.conf")
raise Chef::Exceptions::Service, "No DAEMONS found in /etc/rc.conf" unless /DAEMONS=\((.*)\)/m.match?(::File.read("/etc/rc.conf"))
super
diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb
index a89907bb50..da599fa2f6 100644
--- a/lib/chef/provider/service/debian.rb
+++ b/lib/chef/provider/service/debian.rb
@@ -45,7 +45,7 @@ class Chef
shared_resource_requirements
requirements.assert(:all_actions) do |a|
update_rcd = "/usr/sbin/update-rc.d"
- a.assertion { ::File.exists? update_rcd }
+ a.assertion { ::File.exist? update_rcd }
a.failure_message Chef::Exceptions::Service, "#{update_rcd} does not exist!"
# no whyrun recovery - this is a base system component of debian
# distros and must be present
diff --git a/lib/chef/provider/service/gentoo.rb b/lib/chef/provider/service/gentoo.rb
index 748038cdaf..4678435129 100644
--- a/lib/chef/provider/service/gentoo.rb
+++ b/lib/chef/provider/service/gentoo.rb
@@ -34,7 +34,7 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init
@current_resource.enabled(
Dir.glob("/etc/runlevels/**/#{Chef::Util::PathHelper.escape_glob_dir(@current_resource.service_name)}").any? do |file|
@found_script = true
- exists = ::File.exists? file
+ exists = ::File.exist? file
readable = ::File.readable? file
logger.trace "#{@new_resource} exists: #{exists}, readable: #{readable}"
exists && readable
@@ -47,7 +47,7 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init
def define_resource_requirements
requirements.assert(:all_actions) do |a|
- a.assertion { ::File.exists?("/sbin/rc-update") }
+ a.assertion { ::File.exist?("/sbin/rc-update") }
a.failure_message Chef::Exceptions::Service, "/sbin/rc-update does not exist"
# no whyrun recovery -t his is a core component whose presence is
# unlikely to be affected by what we do in the course of a chef run
diff --git a/lib/chef/provider/service/macosx.rb b/lib/chef/provider/service/macosx.rb
index a2f8f15b7b..7e695aaf2b 100644
--- a/lib/chef/provider/service/macosx.rb
+++ b/lib/chef/provider/service/macosx.rb
@@ -81,7 +81,7 @@ class Chef
end
requirements.assert(:all_actions) do |a|
- a.assertion { ::File.exists?(@plist.to_s) }
+ a.assertion { ::File.exist?(@plist.to_s) }
a.failure_message Chef::Exceptions::Service,
"Could not find plist for #{@new_resource}"
end
@@ -221,7 +221,7 @@ class Chef
return nil if @plist.nil?
# Plist must exist by this point
- raise Chef::Exceptions::FileNotFound, "Cannot find #{@plist}!" unless ::File.exists?(@plist)
+ raise Chef::Exceptions::FileNotFound, "Cannot find #{@plist}!" unless ::File.exist?(@plist)
# Most services have the same internal label as the name of the
# plist file. However, there is no rule saying that *has* to be
diff --git a/lib/chef/provider/service/openbsd.rb b/lib/chef/provider/service/openbsd.rb
index 99e8cff6aa..2b484f9fc8 100644
--- a/lib/chef/provider/service/openbsd.rb
+++ b/lib/chef/provider/service/openbsd.rb
@@ -129,7 +129,7 @@ class Chef
end
def update_rcl(value)
- FileUtils.touch RC_CONF_LOCAL_PATH unless ::File.exists? RC_CONF_LOCAL_PATH
+ FileUtils.touch RC_CONF_LOCAL_PATH unless ::File.exist? RC_CONF_LOCAL_PATH
::File.write(RC_CONF_LOCAL_PATH, value)
@rc_conf_local = value
end
diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb
index ec78ef2240..3ef7110002 100644
--- a/lib/chef/provider/service/redhat.rb
+++ b/lib/chef/provider/service/redhat.rb
@@ -56,7 +56,7 @@ class Chef
requirements.assert(:all_actions) do |a|
chkconfig_file = "/sbin/chkconfig"
- a.assertion { ::File.exists? chkconfig_file }
+ a.assertion { ::File.exist? chkconfig_file }
a.failure_message Chef::Exceptions::Service, "#{chkconfig_file} does not exist!"
end
@@ -80,7 +80,7 @@ class Chef
super
- if ::File.exists?("/sbin/chkconfig")
+ if ::File.exist?("/sbin/chkconfig")
chkconfig = shell_out!("/sbin/chkconfig --list #{current_resource.service_name}", returns: [0, 1])
unless run_levels.nil? || run_levels.empty?
all_levels_match = true
diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb
index 5b93e6f5a9..2b9e304160 100644
--- a/lib/chef/provider/service/upstart.rb
+++ b/lib/chef/provider/service/upstart.rb
@@ -135,7 +135,7 @@ class Chef
end
end
# Get enabled/disabled state by reading job configuration file
- if ::File.exists?("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
+ if ::File.exist?("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
logger.trace("#{@new_resource} found #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
::File.open("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}", "r") do |file|
while line = file.gets
diff --git a/lib/chef/resource/sudo.rb b/lib/chef/resource/sudo.rb
index bd1c7de60e..99bea022ef 100644
--- a/lib/chef/resource/sudo.rb
+++ b/lib/chef/resource/sudo.rb
@@ -255,7 +255,7 @@ class Chef
end
def visudo_content(path)
- if ::File.exists?(path)
+ if ::File.exist?(path)
"cat #{new_resource.config_prefix}/sudoers | #{new_resource.visudo_binary} -cf - && #{new_resource.visudo_binary} -cf %{path}"
else
"cat #{new_resource.config_prefix}/sudoers %{path} | #{new_resource.visudo_binary} -cf -"
diff --git a/lib/chef/role.rb b/lib/chef/role.rb
index 9142f85d15..d43e331da4 100644
--- a/lib/chef/role.rb
+++ b/lib/chef/role.rb
@@ -256,11 +256,11 @@ class Chef
js_path, rb_path = js_files.first, rb_files.first
- if js_path && File.exists?(js_path)
+ if js_path && File.exist?(js_path)
# from_json returns object.class => json_class in the JSON.
hsh = Chef::JSONCompat.parse(IO.read(js_path))
return from_hash(hsh)
- elsif rb_path && File.exists?(rb_path)
+ elsif rb_path && File.exist?(rb_path)
role = Chef::Role.new
role.name(name)
role.from_file(rb_path)
diff --git a/lib/chef/shell.rb b/lib/chef/shell.rb
index fbee4c093b..8429110eec 100644
--- a/lib/chef/shell.rb
+++ b/lib/chef/shell.rb
@@ -339,7 +339,7 @@ module Shell
config[:config_file] = config_file_for_shell_mode(environment)
config_msg = config[:config_file] || "none (standalone session)"
puts "loading configuration: #{config_msg}"
- Chef::Config.from_file(config[:config_file]) if !config[:config_file].nil? && File.exists?(config[:config_file]) && File.readable?(config[:config_file])
+ Chef::Config.from_file(config[:config_file]) if !config[:config_file].nil? && File.exist?(config[:config_file]) && File.readable?(config[:config_file])
Chef::Config.merge!(config)
end
diff --git a/lib/chef/util/diff.rb b/lib/chef/util/diff.rb
index 806da5922e..3f8a925c4d 100644
--- a/lib/chef/util/diff.rb
+++ b/lib/chef/util/diff.rb
@@ -63,7 +63,7 @@ class Chef
def use_tempfile_if_missing(file)
tempfile = nil
- unless File.exists?(file)
+ unless File.exist?(file)
Chef::Log.trace("File #{file} does not exist to diff against, using empty tempfile")
tempfile = Tempfile.new("chef-diff")
file = tempfile.path
diff --git a/lib/chef/util/powershell/cmdlet.rb b/lib/chef/util/powershell/cmdlet.rb
index e9e3be1738..344e20f466 100644
--- a/lib/chef/util/powershell/cmdlet.rb
+++ b/lib/chef/util/powershell/cmdlet.rb
@@ -164,7 +164,7 @@ class Chef
end
def self.destroy(name)
- proc { File.delete(name) if File.exists? name }
+ proc { File.delete(name) if File.exist? name }
end
end
end
diff --git a/lib/chef/win32/file.rb b/lib/chef/win32/file.rb
index e051a53e4d..e898144414 100644
--- a/lib/chef/win32/file.rb
+++ b/lib/chef/win32/file.rb
@@ -78,7 +78,7 @@ class Chef
def self.symlink?(file_name)
is_symlink = false
path = encode_path(file_name)
- if ::File.exists?(file_name) || ::File.symlink?(file_name)
+ if ::File.exist?(file_name) || ::File.symlink?(file_name)
if (GetFileAttributesW(path) & FILE_ATTRIBUTE_REPARSE_POINT) > 0
file_search_handle(file_name) do |handle, find_data|
if find_data[:dw_reserved_0] == IO_REPARSE_TAG_SYMLINK
@@ -104,7 +104,7 @@ class Chef
# will raise a NotImplementedError, as per MRI.
#
def self.readlink(link_name)
- raise Errno::ENOENT, link_name unless ::File.exists?(link_name) || ::File.symlink?(link_name)
+ raise Errno::ENOENT, link_name unless ::File.exist?(link_name) || ::File.symlink?(link_name)
symlink_file_handle(link_name) do |handle|
# Go to DeviceIoControl to get the symlink information
diff --git a/spec/functional/resource/aixinit_service_spec.rb b/spec/functional/resource/aixinit_service_spec.rb
index 6d1df895bf..ecbe0c23fa 100755
--- a/spec/functional/resource/aixinit_service_spec.rb
+++ b/spec/functional/resource/aixinit_service_spec.rb
@@ -27,11 +27,11 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
# Platform specific validation routines.
def service_should_be_started(file_name)
# The existence of this file indicates that the service was started.
- expect(File.exists?("#{Dir.tmpdir}/#{file_name}")).to be_truthy
+ expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_truthy
end
def service_should_be_stopped(file_name)
- expect(File.exists?("#{Dir.tmpdir}/#{file_name}")).to be_falsey
+ expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_falsey
end
def valide_symlinks(expected_output, run_level = nil, status = nil, priority = nil)
@@ -68,12 +68,12 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
end
before(:all) do
- File.delete("/etc/rc.d/init.d/chefinittest") if File.exists?("/etc/rc.d/init.d/chefinittest")
+ File.delete("/etc/rc.d/init.d/chefinittest") if File.exist?("/etc/rc.d/init.d/chefinittest")
FileUtils.cp((File.join(File.dirname(__FILE__), "/../assets/chefinittest")).to_s, "/etc/rc.d/init.d/chefinittest")
end
after(:all) do
- File.delete("/etc/rc.d/init.d/chefinittest") if File.exists?("/etc/rc.d/init.d/chefinittest")
+ File.delete("/etc/rc.d/init.d/chefinittest") if File.exist?("/etc/rc.d/init.d/chefinittest")
end
before(:each) do
@@ -165,7 +165,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
end
after do
- File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exists?("/etc/rc.d/rc2.d/chefinittest")
+ File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exist?("/etc/rc.d/rc2.d/chefinittest")
end
it "creates symlink with status K" do
@@ -181,7 +181,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
end
after do
- File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exists?("/etc/rc.d/rc2.d/chefinittest")
+ File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exist?("/etc/rc.d/rc2.d/chefinittest")
end
it "creates a symlink with status K and a priority" do
@@ -198,7 +198,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
end
after do
- File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exists?("/etc/rc.d/rc2.d/chefinittest")
+ File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exist?("/etc/rc.d/rc2.d/chefinittest")
end
it "create symlink with status stop (K) and a priority " do
diff --git a/spec/functional/resource/bff_spec.rb b/spec/functional/resource/bff_spec.rb
index ad45552c16..cdcc086180 100644
--- a/spec/functional/resource/bff_spec.rb
+++ b/spec/functional/resource/bff_spec.rb
@@ -31,12 +31,12 @@ describe Chef::Resource::BffPackage, :requires_root, external: ohai[:platform] !
def bff_pkg_should_be_installed(resource)
expect(shell_out("lslpp -L #{resource.name}").exitstatus).to eq(0)
- ::File.exists?("/usr/PkgA/bin/acommand")
+ ::File.exist?("/usr/PkgA/bin/acommand")
end
def bff_pkg_should_be_removed(resource)
expect(shell_out("lslpp -L #{resource.name}").exitstatus).to eq(1)
- !::File.exists?("/usr/PkgA/bin/acommand")
+ !::File.exist?("/usr/PkgA/bin/acommand")
end
before(:all) do
diff --git a/spec/functional/resource/cookbook_file_spec.rb b/spec/functional/resource/cookbook_file_spec.rb
index 9d6600d554..8dbf22d611 100644
--- a/spec/functional/resource/cookbook_file_spec.rb
+++ b/spec/functional/resource/cookbook_file_spec.rb
@@ -72,7 +72,7 @@ describe Chef::Resource::CookbookFile do
end
after do
- FileUtils.rm_r(windows_non_temp_dir) if ChefUtils.windows? && File.exists?(windows_non_temp_dir)
+ FileUtils.rm_r(windows_non_temp_dir) if ChefUtils.windows? && File.exist?(windows_non_temp_dir)
end
end
diff --git a/spec/functional/resource/dsc_resource_spec.rb b/spec/functional/resource/dsc_resource_spec.rb
index 1c7a73693b..227811a5ef 100644
--- a/spec/functional/resource/dsc_resource_spec.rb
+++ b/spec/functional/resource/dsc_resource_spec.rb
@@ -62,7 +62,7 @@ describe Chef::Resource::DscResource, :windows_powershell_dsc_only do
end
after do
- File.delete(tmp_file_name) if File.exists? tmp_file_name
+ File.delete(tmp_file_name) if File.exist? tmp_file_name
end
it "converges the resource if it is not converged" do
diff --git a/spec/functional/resource/insserv_spec.rb b/spec/functional/resource/insserv_spec.rb
index bd3b98a1e2..92275fffba 100644
--- a/spec/functional/resource/insserv_spec.rb
+++ b/spec/functional/resource/insserv_spec.rb
@@ -38,11 +38,11 @@ describe Chef::Resource::Service, :requires_root, :opensuse do
# Platform specific validation routines.
def service_should_be_started(file_name)
# The existence of this file indicates that the service was started.
- expect(File.exists?("#{Dir.tmpdir}/#{file_name}")).to be_truthy
+ expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_truthy
end
def service_should_be_stopped(file_name)
- expect(File.exists?("#{Dir.tmpdir}/#{file_name}")).to be_falsey
+ expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_falsey
end
def delete_test_files
@@ -73,13 +73,13 @@ describe Chef::Resource::Service, :requires_root, :opensuse do
end
before(:all) do
- File.delete("/etc/init.d/inittest") if File.exists?("/etc/init.d/inittest")
+ File.delete("/etc/init.d/inittest") if File.exist?("/etc/init.d/inittest")
FileUtils.cp((File.join(File.dirname(__FILE__), "/../assets/inittest")).to_s, "/etc/init.d/inittest")
FileUtils.chmod(0755, "/etc/init.d/inittest")
end
after(:all) do
- File.delete("/etc/init.d/inittest") if File.exists?("/etc/init.d/inittest")
+ File.delete("/etc/init.d/inittest") if File.exist?("/etc/init.d/inittest")
end
before(:each) do
diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb
index fc260845e4..a917bd8db6 100644
--- a/spec/functional/resource/link_spec.rb
+++ b/spec/functional/resource/link_spec.rb
@@ -56,9 +56,9 @@ describe Chef::Resource::Link do
after(:each) do
- cleanup_link(to) if File.exists?(to)
- cleanup_link(target_file) if File.exists?(target_file)
- cleanup_link(CHEF_SPEC_BACKUP_PATH) if File.exists?(CHEF_SPEC_BACKUP_PATH)
+ cleanup_link(to) if File.exist?(to)
+ cleanup_link(target_file) if File.exist?(target_file)
+ cleanup_link(CHEF_SPEC_BACKUP_PATH) if File.exist?(CHEF_SPEC_BACKUP_PATH)
rescue
puts "Could not remove a file: #{$!}"
@@ -273,7 +273,7 @@ describe Chef::Resource::Link do
resource.run_action(:create)
end
it "preserves the hard link" do
- expect(File.exists?(target_file)).to be_truthy
+ expect(File.exist?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_falsey
# Writing to one hardlinked file should cause both
# to have the new value.
@@ -298,7 +298,7 @@ describe Chef::Resource::Link do
resource.run_action(:create)
end
it "links to the target file" do
- expect(File.exists?(target_file)).to be_truthy
+ expect(File.exist?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_falsey
# Writing to one hardlinked file should cause both
# to have the new value.
@@ -338,7 +338,7 @@ describe Chef::Resource::Link do
include_context "delete succeeds"
it "the :delete action does not delete the target file" do
resource.run_action(:delete)
- expect(File.exists?(to)).to be_truthy
+ expect(File.exist?(to)).to be_truthy
end
end
context "pointing somewhere else", :requires_root_or_running_windows do
@@ -366,7 +366,7 @@ describe Chef::Resource::Link do
include_context "delete succeeds"
it "the :delete action does not delete the target file" do
resource.run_action(:delete)
- expect(File.exists?(to)).to be_truthy
+ expect(File.exist?(to)).to be_truthy
end
end
context "pointing nowhere" do
@@ -383,7 +383,7 @@ describe Chef::Resource::Link do
context "and the link already exists and is a hard link to the file" do
before(:each) do
link(to, target_file)
- expect(File.exists?(target_file)).to be_truthy
+ expect(File.exist?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_falsey
end
include_context "create symbolic link succeeds"
@@ -582,14 +582,14 @@ describe Chef::Resource::Link do
context "and the link already exists and is a hard link to the file" do
before(:each) do
link(to, target_file)
- expect(File.exists?(target_file)).to be_truthy
+ expect(File.exist?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_falsey
end
include_context "create hard link is noop"
include_context "delete succeeds"
it "the :delete action does not delete the target file" do
resource.run_action(:delete)
- expect(File.exists?(to)).to be_truthy
+ expect(File.exist?(to)).to be_truthy
end
end
context "and the link already exists and is a file" do
@@ -655,7 +655,7 @@ describe Chef::Resource::Link do
it "links to the target file" do
skip("macOS/FreeBSD/AIX/Solaris symlink? and readlink working on hard links to symlinks") if os_x? || freebsd? || aix? || solaris?
resource.run_action(:create)
- expect(File.exists?(target_file)).to be_truthy
+ expect(File.exist?(target_file)).to be_truthy
# macOS gets angry about this sort of link. Bug in macOS, IMO.
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(@other_target))
@@ -674,7 +674,7 @@ describe Chef::Resource::Link do
it "links to the target file" do
skip("macOS/FreeBSD/AIX/Solaris fails to create hardlinks to broken symlinks") if os_x? || freebsd? || aix? || solaris?
resource.run_action(:create)
- expect(File.exists?(target_file) || File.symlink?(target_file)).to be_truthy
+ expect(File.exist?(target_file) || File.symlink?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(@other_target))
end
diff --git a/spec/functional/resource/rpm_spec.rb b/spec/functional/resource/rpm_spec.rb
index 8a6cf32882..15b6731357 100644
--- a/spec/functional/resource/rpm_spec.rb
+++ b/spec/functional/resource/rpm_spec.rb
@@ -39,7 +39,7 @@ describe Chef::Resource::RpmPackage, :requires_root, external: exclude_test do
# mytest rpm package works in centos, redhat and in suse without any dependency issues.
else
expect(shell_out("rpm -qa | grep mytest").exitstatus).to eq(0)
- ::File.exists?("/opt/mytest/mytest.sh") # The mytest rpm package contains the mytest.sh file
+ ::File.exist?("/opt/mytest/mytest.sh") # The mytest rpm package contains the mytest.sh file
end
end
@@ -48,7 +48,7 @@ describe Chef::Resource::RpmPackage, :requires_root, external: exclude_test do
expect(shell_out("rpm -qa | grep dummy").exitstatus).to eq(1)
else
expect(shell_out("rpm -qa | grep mytest").exitstatus).to eq(1)
- !::File.exists?("/opt/mytest/mytest.sh")
+ !::File.exist?("/opt/mytest/mytest.sh")
end
end
diff --git a/spec/functional/resource/windows_certificate_spec.rb b/spec/functional/resource/windows_certificate_spec.rb
index f64d9e1b62..9c996fe1f8 100644
--- a/spec/functional/resource/windows_certificate_spec.rb
+++ b/spec/functional/resource/windows_certificate_spec.rb
@@ -390,7 +390,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
end
after do
- if File.exists?(out_path)
+ if File.exist?(out_path)
File.delete(out_path)
end
end
@@ -405,7 +405,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
expect(no_of_certificates).to eq(1)
end
it "Stores Certificate content at given path" do
- expect(File.exists?(out_path)).to be_truthy
+ expect(File.exist?(out_path)).to be_truthy
end
it "Does not converge while fetching" do
expect(win_certificate).not_to be_updated_by_last_action
@@ -425,7 +425,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
expect(stdout.string.strip).to be_empty
end
it "Does not store certificate content at given path" do
- expect(File.exists?(out_path)).to be_falsy
+ expect(File.exist?(out_path)).to be_falsy
end
it "Does not converge while fetching" do
expect(win_certificate).not_to be_updated_by_last_action
diff --git a/spec/functional/win32/service_manager_spec.rb b/spec/functional/win32/service_manager_spec.rb
index 4847ce0482..5746283b78 100644
--- a/spec/functional/win32/service_manager_spec.rb
+++ b/spec/functional/win32/service_manager_spec.rb
@@ -125,7 +125,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
it "start should start the service", :volatile do
service_manager.run(["-a", "start"])
expect(test_service_state).to eq("running")
- expect(File.exists?(test_service_file)).to be_truthy
+ expect(File.exist?(test_service_file)).to be_truthy
end
it "stop should not affect the service" do
diff --git a/spec/integration/recipes/lwrp_inline_resources_spec.rb b/spec/integration/recipes/lwrp_inline_resources_spec.rb
index dff2c886be..48f7952af0 100644
--- a/spec/integration/recipes/lwrp_inline_resources_spec.rb
+++ b/spec/integration/recipes/lwrp_inline_resources_spec.rb
@@ -59,7 +59,7 @@ describe "LWRPs with inline resources" do
end
end
- after { File.delete(LwrpShadowedPropertyTest::PATH) if File.exists?(LwrpShadowedPropertyTest::PATH) }
+ after { File.delete(LwrpShadowedPropertyTest::PATH) if File.exist?(LwrpShadowedPropertyTest::PATH) }
# https://github.com/chef/chef/issues/4334
it "does not warn spuriously" do
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 6dcd4b0551..165f87327c 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -68,7 +68,7 @@ end
# If you want to load anything into the testing environment
# without versioning it, add it to spec/support/local_gems.rb
-require "spec/support/local_gems.rb" if File.exists?(File.join(File.dirname(__FILE__), "support", "local_gems.rb"))
+require "spec/support/local_gems.rb" if File.exist?(File.join(File.dirname(__FILE__), "support", "local_gems.rb"))
# Explicitly require spec helpers that need to load first
require "spec/support/platform_helpers"
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index 7e17b75206..38c778294f 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -105,7 +105,7 @@ def mac_osx_1014?
end
def mac_osx?
- if File.exists? "/usr/bin/sw_vers"
+ if File.exist? "/usr/bin/sw_vers"
result = ShellHelpers.shell_out("/usr/bin/sw_vers")
result.stdout.each_line do |line|
if /^ProductName:\sMac OS X.*$/.match?(line)
@@ -216,8 +216,8 @@ def selinux_enabled?
end
def suse?
- ::File.exists?("/etc/SuSE-release") ||
- ( ::File.exists?("/etc/os-release") && /sles|suse/.match?(File.read("/etc/os-release")) )
+ ::File.exist?("/etc/SuSE-release") ||
+ ( ::File.exist?("/etc/os-release") && /sles|suse/.match?(File.read("/etc/os-release")) )
end
def root?
diff --git a/spec/support/platforms/win32/spec_service.rb b/spec/support/platforms/win32/spec_service.rb
index 34bb1fe3db..27f71a8bf0 100644
--- a/spec/support/platforms/win32/spec_service.rb
+++ b/spec/support/platforms/win32/spec_service.rb
@@ -26,7 +26,7 @@ if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
def service_main(*startup_parameters)
while running?
- unless File.exists?(@test_service_file)
+ unless File.exist?(@test_service_file)
File.open(@test_service_file, "wb") do |f|
f.write("This file is created by SpecService")
end
diff --git a/spec/support/shared/functional/directory_resource.rb b/spec/support/shared/functional/directory_resource.rb
index 62055ca07d..cd05280aa8 100644
--- a/spec/support/shared/functional/directory_resource.rb
+++ b/spec/support/shared/functional/directory_resource.rb
@@ -173,6 +173,6 @@ shared_context Chef::Resource::Directory do
end
after(:each) do
- FileUtils.rm_r(path) if File.exists?(path)
+ FileUtils.rm_r(path) if File.exist?(path)
end
end
diff --git a/spec/support/shared/functional/execute_resource.rb b/spec/support/shared/functional/execute_resource.rb
index 5e0c9e4e28..9d1c29dfac 100644
--- a/spec/support/shared/functional/execute_resource.rb
+++ b/spec/support/shared/functional/execute_resource.rb
@@ -62,7 +62,7 @@ shared_context "a command that can be executed as an alternate user" do
end
after do
- File.delete(script_output_path) if File.exists?(script_output_path)
+ File.delete(script_output_path) if File.exist?(script_output_path)
Dir.rmdir(script_output_dir) if Dir.exist?(script_output_dir)
end
end
diff --git a/spec/support/shared/functional/file_resource.rb b/spec/support/shared/functional/file_resource.rb
index 77e823a682..1385d3dc30 100644
--- a/spec/support/shared/functional/file_resource.rb
+++ b/spec/support/shared/functional/file_resource.rb
@@ -1037,8 +1037,8 @@ shared_context Chef::Resource::File do
end
after(:each) do
- FileUtils.rm_r(path) if File.exists?(path)
- FileUtils.rm_r(CHEF_SPEC_BACKUP_PATH) if File.exists?(CHEF_SPEC_BACKUP_PATH)
+ FileUtils.rm_r(path) if File.exist?(path)
+ FileUtils.rm_r(CHEF_SPEC_BACKUP_PATH) if File.exist?(CHEF_SPEC_BACKUP_PATH)
end
after do
diff --git a/spec/support/shared/functional/win32_service.rb b/spec/support/shared/functional/win32_service.rb
index 2d14c6cf86..dfd66f74ad 100644
--- a/spec/support/shared/functional/win32_service.rb
+++ b/spec/support/shared/functional/win32_service.rb
@@ -30,7 +30,7 @@ shared_context "using Win32::Service" do
end
# Delete the test_service_file if it exists
- if File.exists?(test_service_file)
+ if File.exist?(test_service_file)
File.delete(test_service_file)
end
end
diff --git a/spec/support/shared/functional/windows_script.rb b/spec/support/shared/functional/windows_script.rb
index 3ccb7b6e37..151ad2387c 100644
--- a/spec/support/shared/functional/windows_script.rb
+++ b/spec/support/shared/functional/windows_script.rb
@@ -39,11 +39,11 @@ shared_context Chef::Resource::WindowsScript do
end
before(:each) do
- File.delete(script_output_path) if File.exists?(script_output_path)
+ File.delete(script_output_path) if File.exist?(script_output_path)
end
after(:each) do
- File.delete(script_output_path) if File.exists?(script_output_path)
+ File.delete(script_output_path) if File.exist?(script_output_path)
end
shared_examples_for "a script resource with architecture attribute" do
@@ -138,7 +138,7 @@ shared_context Chef::Resource::WindowsScript do
after do
script_file.close! if script_file
- ::File.delete(script_file.to_path) if script_file && ::File.exists?(script_file.to_path)
+ ::File.delete(script_file.to_path) if script_file && ::File.exist?(script_file.to_path)
end
include_context "alternate user identity"
diff --git a/spec/unit/environment_spec.rb b/spec/unit/environment_spec.rb
index 93b4a5011c..33553aed35 100644
--- a/spec/unit/environment_spec.rb
+++ b/spec/unit/environment_spec.rb
@@ -402,8 +402,8 @@ describe Chef::Environment do
it "should get the environment from the environment_path" do
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.rb")).exactly(1).times.and_return(true)
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.rb")).exactly(1).times.and_return(true)
expect(File).to receive(:readable?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
expect(File).to receive(:file?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
role_dsl = "name \"foo\"\ndescription \"desc\"\n"
@@ -413,7 +413,7 @@ describe Chef::Environment do
it "should return a Chef::Environment object from JSON" do
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(true)
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(true)
environment_hash = {
"name" => "foo",
"default_attributes" => {
@@ -436,8 +436,8 @@ describe Chef::Environment do
it "should return a Chef::Environment object from Ruby DSL" do
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.rb")).exactly(1).times.and_return(true)
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.rb")).exactly(1).times.and_return(true)
expect(File).to receive(:readable?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
expect(File).to receive(:file?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
role_dsl = "name \"foo\"\ndescription \"desc\"\n"
@@ -463,8 +463,8 @@ describe Chef::Environment do
it "should raise an error if the file does not exist" do
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(false)
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(false)
expect do
Chef::Environment.load("foo")
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index e0694f047b..130a097da2 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -206,7 +206,7 @@ describe Chef::Knife::Bootstrap do
end
before(:each) do
- expect(File).to receive(:exists?).with(bootstrap_template).and_return(false)
+ expect(File).to receive(:exist?).with(bootstrap_template).and_return(false)
end
context "when file is available everywhere" do
@@ -215,7 +215,7 @@ describe Chef::Knife::Bootstrap do
configure_env_home
configure_gem_files
- expect(File).to receive(:exists?).with(builtin_template_path).and_return(true)
+ expect(File).to receive(:exist?).with(builtin_template_path).and_return(true)
end
it "should load the template from built-in templates" do
@@ -229,8 +229,8 @@ describe Chef::Knife::Bootstrap do
configure_env_home
configure_gem_files
- expect(File).to receive(:exists?).with(builtin_template_path).and_return(false)
- expect(File).to receive(:exists?).with(chef_config_dir_template_path).and_return(true)
+ expect(File).to receive(:exist?).with(builtin_template_path).and_return(false)
+ expect(File).to receive(:exist?).with(chef_config_dir_template_path).and_return(true)
it "should load the template from chef_config_dir" do
knife.find_template.should eq(chef_config_dir_template_path)
@@ -244,9 +244,9 @@ describe Chef::Knife::Bootstrap do
configure_env_home
configure_gem_files
- expect(File).to receive(:exists?).with(builtin_template_path).and_return(false)
- expect(File).to receive(:exists?).with(chef_config_dir_template_path).and_return(false)
- expect(File).to receive(:exists?).with(env_home_template_path).and_return(true)
+ expect(File).to receive(:exist?).with(builtin_template_path).and_return(false)
+ expect(File).to receive(:exist?).with(chef_config_dir_template_path).and_return(false)
+ expect(File).to receive(:exist?).with(env_home_template_path).and_return(true)
end
it "should load the template from chef_config_dir" do
@@ -260,10 +260,10 @@ describe Chef::Knife::Bootstrap do
configure_env_home
configure_gem_files
- expect(File).to receive(:exists?).with(builtin_template_path).and_return(false)
- expect(File).to receive(:exists?).with(chef_config_dir_template_path).and_return(false)
- expect(File).to receive(:exists?).with(env_home_template_path).and_return(false)
- expect(File).to receive(:exists?).with(gem_files_template_path).and_return(true)
+ expect(File).to receive(:exist?).with(builtin_template_path).and_return(false)
+ expect(File).to receive(:exist?).with(chef_config_dir_template_path).and_return(false)
+ expect(File).to receive(:exist?).with(env_home_template_path).and_return(false)
+ expect(File).to receive(:exist?).with(gem_files_template_path).and_return(true)
end
it "should load the template from Gem files" do
@@ -277,9 +277,9 @@ describe Chef::Knife::Bootstrap do
configure_gem_files
allow(Chef::Util::PathHelper).to receive(:home).with(".chef", "bootstrap", "example.erb").and_return(nil)
- expect(File).to receive(:exists?).with(builtin_template_path).and_return(false)
- expect(File).to receive(:exists?).with(chef_config_dir_template_path).and_return(false)
- expect(File).to receive(:exists?).with(gem_files_template_path).and_return(true)
+ expect(File).to receive(:exist?).with(builtin_template_path).and_return(false)
+ expect(File).to receive(:exist?).with(chef_config_dir_template_path).and_return(false)
+ expect(File).to receive(:exist?).with(gem_files_template_path).and_return(true)
end
it "should load the template from Gem files" do
diff --git a/spec/unit/knife/cookbook_download_spec.rb b/spec/unit/knife/cookbook_download_spec.rb
index 2d1d70cb51..62b6e58c75 100644
--- a/spec/unit/knife/cookbook_download_spec.rb
+++ b/spec/unit/knife/cookbook_download_spec.rb
@@ -94,7 +94,7 @@ describe Chef::Knife::CookbookDownload do
let(:manifest_data) { { all_files: [] } }
it "should determine which version to download" do
expect(@knife).to receive(:determine_version).and_return("1.0.0")
- expect(File).to receive(:exists?).with("/var/tmp/chef/foobar-1.0.0").and_return(false)
+ expect(File).to receive(:exist?).with("/var/tmp/chef/foobar-1.0.0").and_return(false)
@knife.run
end
end
@@ -111,7 +111,7 @@ describe Chef::Knife::CookbookDownload do
end
it "should print an error and exit if the cookbook download directory already exists" do
- expect(File).to receive(:exists?).with("/var/tmp/chef/foobar-1.0.0").and_return(true)
+ expect(File).to receive(:exist?).with("/var/tmp/chef/foobar-1.0.0").and_return(true)
expect(@knife.ui).to receive(:fatal).with(%r{/var/tmp/chef/foobar-1\.0\.0 exists}i)
expect { @knife.run }.to raise_error(SystemExit)
end
@@ -135,7 +135,7 @@ describe Chef::Knife::CookbookDownload do
end
it "should download the cookbook when the cookbook download directory doesn't exist" do
- expect(File).to receive(:exists?).with("/var/tmp/chef/foobar-1.0.0").and_return(false)
+ expect(File).to receive(:exist?).with("/var/tmp/chef/foobar-1.0.0").and_return(false)
@knife.run
%w{attributes recipes templates}.each do |segment|
expect(@stderr.string).to match /downloading #{segment}/im
@@ -147,7 +147,7 @@ describe Chef::Knife::CookbookDownload do
describe "with -f or --force" do
it "should remove the existing the cookbook download directory if it exists" do
@knife.config[:force] = true
- expect(File).to receive(:exists?).with("/var/tmp/chef/foobar-1.0.0").and_return(true)
+ expect(File).to receive(:exist?).with("/var/tmp/chef/foobar-1.0.0").and_return(true)
expect(FileUtils).to receive(:rm_rf).with("/var/tmp/chef/foobar-1.0.0")
@knife.run
end
diff --git a/spec/unit/knife/cookbook_metadata_from_file_spec.rb b/spec/unit/knife/cookbook_metadata_from_file_spec.rb
index e6b5e65621..f9bbffae2d 100644
--- a/spec/unit/knife/cookbook_metadata_from_file_spec.rb
+++ b/spec/unit/knife/cookbook_metadata_from_file_spec.rb
@@ -34,7 +34,7 @@ describe Chef::Knife::CookbookMetadataFromFile do
end
after do
- if File.exists?(@tgt)
+ if File.exist?(@tgt)
File.unlink(@tgt)
end
end
diff --git a/spec/unit/knife/core/hashed_command_loader_spec.rb b/spec/unit/knife/core/hashed_command_loader_spec.rb
index 1958576886..c88656945b 100644
--- a/spec/unit/knife/core/hashed_command_loader_spec.rb
+++ b/spec/unit/knife/core/hashed_command_loader_spec.rb
@@ -50,7 +50,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
describe "#list_commands" do
before do
- allow(File).to receive(:exists?).and_return(true)
+ allow(File).to receive(:exist?).and_return(true)
end
it "lists all commands by category when no argument is given" do
@@ -63,7 +63,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
context "when the plugin path is invalid" do
before do
- expect(File).to receive(:exists?).with("/file/for/plugin/b").and_return(false)
+ expect(File).to receive(:exist?).with("/file/for/plugin/b").and_return(false)
end
it "lists all commands by category when no argument is given" do
@@ -90,7 +90,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
end
it "loads the correct file and returns true if the command exists" do
- allow(File).to receive(:exists?).and_return(true)
+ allow(File).to receive(:exist?).and_return(true)
expect(Kernel).to receive(:load).with("/file/for/plugin/a").and_return(true)
expect(loader.load_command(["cool_a"])).to eq(true)
end
diff --git a/spec/unit/knife/supermarket_share_spec.rb b/spec/unit/knife/supermarket_share_spec.rb
index 6ad6e5f8c7..f6c44f4cd8 100644
--- a/spec/unit/knife/supermarket_share_spec.rb
+++ b/spec/unit/knife/supermarket_share_spec.rb
@@ -108,7 +108,7 @@ describe Chef::Knife::SupermarketShare do
expect { @knife.run }.to raise_error(SystemExit)
end
- if File.exists?("/usr/bin/gnutar") || File.exists?("/bin/gnutar")
+ if File.exist?("/usr/bin/gnutar") || File.exist?("/bin/gnutar")
it "should use gnutar to make a tarball of the cookbook" do
expect(@knife).to receive(:shell_out!) do |args|
expect(args.to_s).to match(/gnutar -czf/)
diff --git a/spec/unit/provider/service/arch_service_spec.rb b/spec/unit/provider/service/arch_service_spec.rb
index cc48459c90..026db3dc75 100644
--- a/spec/unit/provider/service/arch_service_spec.rb
+++ b/spec/unit/provider/service/arch_service_spec.rb
@@ -37,7 +37,8 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
@provider = Chef::Provider::Service::Arch.new(@new_resource, @run_context)
- allow(::File).to receive(:exists?).with("/etc/rc.conf").and_return(true)
+ allow(::File).to receive(:exist?).with("/etc/rc.d/chef").and_return(false)
+ allow(::File).to receive(:exist?).with("/etc/rc.conf").and_return(true)
allow(::File).to receive(:read).with("/etc/rc.conf").and_return("DAEMONS=(network apache sshd)")
end
@@ -106,7 +107,7 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
end
it "should fail if file /etc/rc.conf does not exist" do
- allow(::File).to receive(:exists?).with("/etc/rc.conf").and_return(false)
+ allow(::File).to receive(:exist?).with("/etc/rc.conf").and_return(false)
expect { @provider.load_current_resource }.to raise_error(Chef::Exceptions::Service)
end
diff --git a/spec/unit/provider/service/debian_service_spec.rb b/spec/unit/provider/service/debian_service_spec.rb
index 8fe573de87..d0cd048c4f 100644
--- a/spec/unit/provider/service/debian_service_spec.rb
+++ b/spec/unit/provider/service/debian_service_spec.rb
@@ -47,7 +47,7 @@ describe Chef::Provider::Service::Debian do
describe "load_current_resource" do
it "ensures /usr/sbin/update-rc.d is available" do
- expect(File).to receive(:exists?).with("/usr/sbin/update-rc.d") .and_return(false)
+ expect(File).to receive(:exist?).with("/usr/sbin/update-rc.d").and_return(false)
@provider.define_resource_requirements
expect do
diff --git a/spec/unit/provider/service/gentoo_service_spec.rb b/spec/unit/provider/service/gentoo_service_spec.rb
index 99c01b595b..f195fbe40b 100644
--- a/spec/unit/provider/service/gentoo_service_spec.rb
+++ b/spec/unit/provider/service/gentoo_service_spec.rb
@@ -32,16 +32,16 @@ describe Chef::Provider::Service::Gentoo do
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
@status = double("Status", exitstatus: 0, stdout: @stdout)
allow(@provider).to receive(:shell_out).and_return(@status)
- allow(File).to receive(:exists?).with("/etc/init.d/chef").and_return(true)
- allow(File).to receive(:exists?).with("/sbin/rc-update").and_return(true)
- allow(File).to receive(:exists?).with("/etc/runlevels/default/chef").and_return(false)
+ allow(File).to receive(:exist?).with("/etc/init.d/chef").and_return(true)
+ allow(File).to receive(:exist?).with("/sbin/rc-update").and_return(true)
+ allow(File).to receive(:exist?).with("/etc/runlevels/default/chef").and_return(false)
allow(File).to receive(:readable?).with("/etc/runlevels/default/chef").and_return(false)
end
# new test: found_enabled state
#
describe "load_current_resource" do
it "should raise Chef::Exceptions::Service if /sbin/rc-update does not exist" do
- expect(File).to receive(:exists?).with("/sbin/rc-update").and_return(false)
+ expect(File).to receive(:exist?).with("/sbin/rc-update").and_return(false)
@provider.define_resource_requirements
expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
end
@@ -65,7 +65,7 @@ describe Chef::Provider::Service::Gentoo do
describe "and the file exists and is readable" do
before do
- allow(File).to receive(:exists?).with("/etc/runlevels/default/chef").and_return(true)
+ allow(File).to receive(:exist?).with("/etc/runlevels/default/chef").and_return(true)
allow(File).to receive(:readable?).with("/etc/runlevels/default/chef").and_return(true)
end
it "should set enabled to true" do
@@ -76,7 +76,7 @@ describe Chef::Provider::Service::Gentoo do
describe "and the file exists but is not readable" do
before do
- allow(File).to receive(:exists?).with("/etc/runlevels/default/chef").and_return(true)
+ allow(File).to receive(:exist?).with("/etc/runlevels/default/chef").and_return(true)
allow(File).to receive(:readable?).with("/etc/runlevels/default/chef").and_return(false)
end
@@ -88,7 +88,7 @@ describe Chef::Provider::Service::Gentoo do
describe "and the file does not exist" do
before do
- allow(File).to receive(:exists?).with("/etc/runlevels/default/chef").and_return(false)
+ allow(File).to receive(:exist?).with("/etc/runlevels/default/chef").and_return(false)
allow(File).to receive(:readable?).with("/etc/runlevels/default/chef").and_return("foobarbaz")
end
diff --git a/spec/unit/provider/service/macosx_spec.rb b/spec/unit/provider/service/macosx_spec.rb
index 2941230160..6cc0f88725 100644
--- a/spec/unit/provider/service/macosx_spec.rb
+++ b/spec/unit/provider/service/macosx_spec.rb
@@ -83,7 +83,7 @@ describe Chef::Provider::Service::Macosx do
.with(/(#{su_cmd} '#{cmd}'|#{cmd})/, default_env: false)
.and_return(double("Status",
stdout: launchctl_stdout, exitstatus: 0))
- allow(File).to receive(:exists?).and_return([true], [])
+ allow(File).to receive(:exist?).and_return([true], [])
allow(provider).to receive(:shell_out!)
.with(/plutil -convert xml1 -o/, default_env: false)
.and_return(double("Status", stdout: plutil_stdout))
@@ -109,7 +109,7 @@ describe Chef::Provider::Service::Macosx do
before do
allow(Dir).to receive(:glob).and_return([])
- allow(File).to receive(:exists?).and_return([true], [])
+ allow(File).to receive(:exist?).and_return([true], [])
allow(provider).to receive(:shell_out!)
.with(/plutil -convert xml1 -o/)
.and_raise(Mixlib::ShellOut::ShellCommandFailed)
@@ -165,7 +165,7 @@ describe Chef::Provider::Service::Macosx do
describe "running unsupported actions" do
before do
allow(Dir).to receive(:glob).and_return([(plist).to_s], [])
- allow(File).to receive(:exists?).and_return([true], [])
+ allow(File).to receive(:exist?).and_return([true], [])
end
it "should throw an exception when reload action is attempted" do
expect { provider.run_action(:reload) }.to raise_error(Chef::Exceptions::UnsupportedAction)
diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb
index 9795abf771..d5d2c7ddc0 100644
--- a/spec/unit/provider/service/redhat_spec.rb
+++ b/spec/unit/provider/service/redhat_spec.rb
@@ -21,7 +21,7 @@ require "ostruct"
shared_examples_for "define_resource_requirements_common" do
it "should raise an error if /sbin/chkconfig does not exist" do
- allow(File).to receive(:exists?).with("/sbin/chkconfig").and_return(false)
+ allow(File).to receive(:exist?).with("/sbin/chkconfig").and_return(false)
allow(@provider).to receive(:shell_out).with("/sbin/service chef status").and_raise(Errno::ENOENT)
allow(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_raise(Errno::ENOENT)
@provider.load_current_resource
@@ -55,7 +55,7 @@ describe "Chef::Provider::Service::Redhat" do
@provider = Chef::Provider::Service::Redhat.new(@new_resource, @run_context)
@provider.action = :start
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
- allow(File).to receive(:exists?).with("/sbin/chkconfig").and_return(true)
+ allow(File).to receive(:exist?).with("/sbin/chkconfig").and_return(true)
end
describe "while not in why run mode" do
diff --git a/spec/unit/provider/service/upstart_service_spec.rb b/spec/unit/provider/service/upstart_service_spec.rb
index 572246a807..20cbef11ce 100644
--- a/spec/unit/provider/service/upstart_service_spec.rb
+++ b/spec/unit/provider/service/upstart_service_spec.rb
@@ -74,7 +74,7 @@ describe Chef::Provider::Service::Upstart do
@status = double("Status", exitstatus: 0, stdout: "", stderr: "")
allow(@provider).to receive(:shell_out).and_return(@status)
- allow(::File).to receive(:exists?).and_return(true)
+ allow(::File).to receive(:exist?).and_return(true)
allow(::File).to receive(:open).and_return(true)
end
@@ -181,13 +181,13 @@ describe Chef::Provider::Service::Upstart do
end
it "should assume disable when no job configuration file is found" do
- allow(::File).to receive(:exists?).and_return(false)
+ allow(::File).to receive(:exist?).and_return(false)
expect(@current_resource).to receive(:running).with(false)
@provider.load_current_resource
end
it "should track state when the upstart configuration file fails to load" do
- expect(File).to receive(:exists?).and_return false
+ expect(File).to receive(:exist?).and_return false
@provider.load_current_resource
expect(@provider.instance_variable_get("@config_file_found")).to eq(false)
end
diff --git a/spec/unit/role_spec.rb b/spec/unit/role_spec.rb
index aaabb397ab..86589d1883 100644
--- a/spec/unit/role_spec.rb
+++ b/spec/unit/role_spec.rb
@@ -259,7 +259,7 @@ describe Chef::Role do
it "should return a Chef::Role object from JSON" do
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes", "#{Chef::Config[:role_path]}/memes/lolcat.json"])
file_path = File.join(Chef::Config[:role_path], "memes/lolcat.json")
- expect(File).to receive(:exists?).with(file_path).exactly(1).times.and_return(true)
+ expect(File).to receive(:exist?).with(file_path).exactly(1).times.and_return(true)
expect(IO).to receive(:read).with(file_path).and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
expect(@role).to be_a_kind_of(Chef::Role)
@role.class.from_disk("lolcat")
@@ -268,7 +268,7 @@ describe Chef::Role do
it "should return a Chef::Role object from a Ruby DSL" do
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes", "#{Chef::Config[:role_path]}/memes/lolcat.rb"])
rb_path = File.join(Chef::Config[:role_path], "memes/lolcat.rb")
- expect(File).to receive(:exists?).with(rb_path).exactly(1).times.and_return(true)
+ expect(File).to receive(:exist?).with(rb_path).exactly(1).times.and_return(true)
expect(File).to receive(:readable?).with(rb_path).exactly(1).times.and_return(true)
expect(File).to receive(:file?).with(rb_path).exactly(1).times.and_return(true)
expect(IO).to receive(:read).with(rb_path).and_return(ROLE_DSL)
@@ -280,8 +280,8 @@ describe Chef::Role do
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes", "#{Chef::Config[:role_path]}/memes/lolcat.json", "#{Chef::Config[:role_path]}/memes/lolcat.rb"])
js_path = File.join(Chef::Config[:role_path], "memes/lolcat.json")
rb_path = File.join(Chef::Config[:role_path], "memes/lolcat.rb")
- expect(File).to receive(:exists?).with(js_path).exactly(1).times.and_return(true)
- expect(File).not_to receive(:exists?).with(rb_path)
+ expect(File).to receive(:exist?).with(js_path).exactly(1).times.and_return(true)
+ expect(File).not_to receive(:exist?).with(rb_path)
expect(IO).to receive(:read).with(js_path).and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
expect(@role).to be_a_kind_of(Chef::Role)
@role.class.from_disk("lolcat")
@@ -289,19 +289,19 @@ describe Chef::Role do
it "should raise an exception if the file does not exist" do
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/meme.rb"])
- expect(File).not_to receive(:exists?)
+ expect(File).not_to receive(:exist?)
expect { @role.class.from_disk("lolcat") }.to raise_error(Chef::Exceptions::RoleNotFound)
end
it "should raise an exception if two files exist with the same name" do
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes/lolcat.rb", "#{Chef::Config[:role_path]}/lolcat.rb"])
- expect(File).not_to receive(:exists?)
+ expect(File).not_to receive(:exist?)
expect { @role.class.from_disk("lolcat") }.to raise_error(Chef::Exceptions::DuplicateRole)
end
it "should not raise an exception if two files exist with a similar name" do
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes/lolcat.rb", "#{Chef::Config[:role_path]}/super_lolcat.rb"])
- expect(File).to receive(:exists?).with("#{Chef::Config[:role_path]}/memes/lolcat.rb").and_return(true)
+ expect(File).to receive(:exist?).with("#{Chef::Config[:role_path]}/memes/lolcat.rb").and_return(true)
allow_any_instance_of(Chef::Role).to receive(:from_file).with("#{Chef::Config[:role_path]}/memes/lolcat.rb")
expect { @role.class.from_disk("lolcat") }.not_to raise_error
end
@@ -317,7 +317,7 @@ describe Chef::Role do
it "should return a Chef::Role object from JSON" do
expect(Dir).to receive(:glob).with(File.join(root, "**", "**")).exactly(1).times.and_return(["#{root}/lolcat.json"])
- expect(File).to receive(:exists?).with("#{root}/lolcat.json").exactly(1).times.and_return(true)
+ expect(File).to receive(:exist?).with("#{root}/lolcat.json").exactly(1).times.and_return(true)
expect(IO).to receive(:read).with("#{root}/lolcat.json").and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
expect(@role).to be_a_kind_of(Chef::Role)
@role.class.from_disk("lolcat")
@@ -326,7 +326,7 @@ describe Chef::Role do
it "should return a Chef::Role object from JSON when role is in the second path" do
expect(Dir).to receive(:glob).with(File.join(root, "**", "**")).exactly(1).times.and_return([])
expect(Dir).to receive(:glob).with(File.join("#{root}/path2", "**", "**")).exactly(1).times.and_return(["#{root}/path2/lolcat.json"])
- expect(File).to receive(:exists?).with("#{root}/path2/lolcat.json").exactly(1).times.and_return(true)
+ expect(File).to receive(:exist?).with("#{root}/path2/lolcat.json").exactly(1).times.and_return(true)
expect(IO).to receive(:read).with("#{root}/path2/lolcat.json").and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
expect(@role).to be_a_kind_of(Chef::Role)
@role.class.from_disk("lolcat")
@@ -334,7 +334,7 @@ describe Chef::Role do
it "should return a Chef::Role object from a Ruby DSL" do
expect(Dir).to receive(:glob).with(File.join(root, "**", "**")).exactly(1).times.and_return(["#{root}/lolcat.rb"])
- expect(File).to receive(:exists?).with("#{root}/lolcat.rb").exactly(1).times.and_return(true)
+ expect(File).to receive(:exist?).with("#{root}/lolcat.rb").exactly(1).times.and_return(true)
expect(File).to receive(:readable?).with("#{root}/lolcat.rb").and_return(true)
expect(File).to receive(:file?).with("#{root}/lolcat.rb").and_return(true)
expect(IO).to receive(:read).with("#{root}/lolcat.rb").exactly(1).times.and_return(ROLE_DSL)
@@ -345,7 +345,7 @@ describe Chef::Role do
it "should return a Chef::Role object from a Ruby DSL when role is in the second path" do
expect(Dir).to receive(:glob).with(File.join(root, "**", "**")).exactly(1).times.and_return([])
expect(Dir).to receive(:glob).with(File.join("#{root}/path2", "**", "**")).exactly(1).times.and_return(["#{root}/path2/lolcat.rb"])
- expect(File).to receive(:exists?).with("#{root}/path2/lolcat.rb").exactly(1).times.and_return(true)
+ expect(File).to receive(:exist?).with("#{root}/path2/lolcat.rb").exactly(1).times.and_return(true)
expect(File).to receive(:readable?).with("#{root}/path2/lolcat.rb").and_return(true)
expect(File).to receive(:file?).with("#{root}/path2/lolcat.rb").and_return(true)
expect(IO).to receive(:read).with("#{root}/path2/lolcat.rb").exactly(1).times.and_return(ROLE_DSL)