summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/client_spec.rb4
-rw-r--r--spec/unit/dsl/reboot_pending_spec.rb4
-rw-r--r--spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb4
-rw-r--r--spec/unit/provider/launchd_spec.rb4
-rw-r--r--spec/unit/provider/link_spec.rb14
-rw-r--r--spec/unit/provider/mount/aix_spec.rb4
-rw-r--r--spec/unit/provider/mount/linux_spec.rb9
-rw-r--r--spec/unit/provider/mount/mount_spec.rb12
-rw-r--r--spec/unit/provider/package/rpm_spec.rb2
-rw-r--r--spec/unit/provider/template_spec.rb4
10 files changed, 31 insertions, 30 deletions
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb
index 377a0b8f05..c19a32cecd 100644
--- a/spec/unit/client_spec.rb
+++ b/spec/unit/client_spec.rb
@@ -113,8 +113,8 @@ shared_context "a client run" do
# --Client.register
# Make sure Client#register thinks the client key doesn't
# exist, so it tries to register and create one.
- allow(File).to receive(:exists?).and_call_original
- expect(File).to receive(:exists?)
+ allow(File).to receive(:exist?).and_call_original
+ expect(File).to receive(:exist?)
.with(Chef::Config[:client_key])
.exactly(:once)
.and_return(api_client_exists?)
diff --git a/spec/unit/dsl/reboot_pending_spec.rb b/spec/unit/dsl/reboot_pending_spec.rb
index 4fed3be442..3ad1be9e38 100644
--- a/spec/unit/dsl/reboot_pending_spec.rb
+++ b/spec/unit/dsl/reboot_pending_spec.rb
@@ -57,12 +57,12 @@ describe Chef::DSL::RebootPending do
end
it "should return true if /var/run/reboot-required exists" do
- allow(File).to receive(:exists?).with("/var/run/reboot-required").and_return(true)
+ allow(File).to receive(:exist?).with("/var/run/reboot-required").and_return(true)
expect(recipe.reboot_pending?).to be_truthy
end
it "should return false if /var/run/reboot-required does not exist" do
- allow(File).to receive(:exists?).with("/var/run/reboot-required").and_return(false)
+ allow(File).to receive(:exist?).with("/var/run/reboot-required").and_return(false)
expect(recipe.reboot_pending?).to be_falsey
end
end
diff --git a/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb b/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb
index 9d8fb050da..6693eded03 100644
--- a/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb
+++ b/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb
@@ -115,7 +115,7 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do
# fake code to run through #recipe_snippet
source_file = [ "if true", "var = non_existent", "end" ]
allow(IO).to receive(:readlines).and_return(source_file)
- allow(File).to receive(:exists?).and_return(true)
+ allow(File).to receive(:exist?).and_return(true)
end
it "parses a Windows path" do
@@ -141,7 +141,7 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do
context "when the recipe file does not exist" do
before do
- allow(File).to receive(:exists?).and_return(false)
+ allow(File).to receive(:exist?).and_return(false)
allow(IO).to receive(:readlines).and_raise(Errno::ENOENT)
end
diff --git a/spec/unit/provider/launchd_spec.rb b/spec/unit/provider/launchd_spec.rb
index 6a729c2cb6..b3306d2676 100644
--- a/spec/unit/provider/launchd_spec.rb
+++ b/spec/unit/provider/launchd_spec.rb
@@ -197,7 +197,7 @@ describe Chef::Provider::Launchd do
describe "with an :delete action" do
describe "and the ld file is present" do
before(:each) do
- allow(File).to receive(:exists?).and_return(true)
+ allow(File).to receive(:exist?).and_return(true)
allow(provider).to receive(
:manage_service
).with(:disable).and_return(true)
@@ -218,7 +218,7 @@ describe Chef::Provider::Launchd do
describe "and the ld file is not present" do
before(:each) do
- allow(File).to receive(:exists?).and_return(false)
+ allow(File).to receive(:exist?).and_return(false)
allow(provider).to receive(
:manage_plist
).with(:delete).and_return(true)
diff --git a/spec/unit/provider/link_spec.rb b/spec/unit/provider/link_spec.rb
index eebf0a9d07..b56d67ae77 100644
--- a/spec/unit/provider/link_spec.rb
+++ b/spec/unit/provider/link_spec.rb
@@ -125,7 +125,7 @@ describe Chef::Resource::Link do
describe "when the target doesn't exist" do
before do
- allow(File).to receive(:exists?).with("#{CHEF_SPEC_DATA}/fofile-link").and_return(false)
+ allow(File).to receive(:exist?).with("#{CHEF_SPEC_DATA}/fofile-link").and_return(false)
allow(provider.file_class).to receive(:symlink?).with("#{CHEF_SPEC_DATA}/fofile-link").and_return(false)
provider.load_current_resource
end
@@ -152,13 +152,13 @@ describe Chef::Resource::Link do
allow(stat).to receive(:mode).and_return(0755)
allow(provider.file_class).to receive(:stat).with("#{CHEF_SPEC_DATA}/fofile-link").and_return(stat)
- allow(File).to receive(:exists?).with("#{CHEF_SPEC_DATA}/fofile-link").and_return(true)
+ allow(File).to receive(:exist?).with("#{CHEF_SPEC_DATA}/fofile-link").and_return(true)
allow(provider.file_class).to receive(:symlink?).with("#{CHEF_SPEC_DATA}/fofile-link").and_return(false)
end
describe "and the source does not exist" do
before do
- allow(File).to receive(:exists?).with("#{CHEF_SPEC_DATA}/fofile").and_return(false)
+ allow(File).to receive(:exist?).with("#{CHEF_SPEC_DATA}/fofile").and_return(false)
provider.load_current_resource
end
@@ -185,7 +185,7 @@ describe Chef::Resource::Link do
allow(provider.file_class).to receive(:stat).with("#{CHEF_SPEC_DATA}/fofile").and_return(stat)
- allow(File).to receive(:exists?).with("#{CHEF_SPEC_DATA}/fofile").and_return(true)
+ allow(File).to receive(:exist?).with("#{CHEF_SPEC_DATA}/fofile").and_return(true)
provider.load_current_resource
end
@@ -212,7 +212,7 @@ describe Chef::Resource::Link do
allow(provider.file_class).to receive(:stat).with("#{CHEF_SPEC_DATA}/fofile").and_return(stat)
- allow(File).to receive(:exists?).with("#{CHEF_SPEC_DATA}/fofile").and_return(true)
+ allow(File).to receive(:exist?).with("#{CHEF_SPEC_DATA}/fofile").and_return(true)
provider.load_current_resource
end
@@ -336,10 +336,10 @@ describe Chef::Resource::Link do
"#{CHEF_SPEC_DATA}/fofile-link"
).and_return(false)
- allow(File).to receive(:exists?).with(
+ allow(File).to receive(:exist?).with(
"#{CHEF_SPEC_DATA}/fofile-link"
).and_return(true)
- allow(File).to receive(:exists?).with(
+ allow(File).to receive(:exist?).with(
"#{CHEF_SPEC_DATA}/fofile"
).and_return(true)
diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb
index 3d77a23bd6..de00528b68 100644
--- a/spec/unit/provider/mount/aix_spec.rb
+++ b/spec/unit/provider/mount/aix_spec.rb
@@ -65,8 +65,8 @@ describe Chef::Provider::Mount::Aix do
@provider = Chef::Provider::Mount::Aix.new(@new_resource, @run_context)
- allow(::File).to receive(:exists?).with("/dev/sdz1").and_return true
- allow(::File).to receive(:exists?).with("/tmp/foo").and_return true
+ allow(::File).to receive(:exist?).with("/dev/sdz1").and_return true
+ allow(::File).to receive(:exist?).with("/tmp/foo").and_return true
end
def stub_mounted(provider, mounted_output)
diff --git a/spec/unit/provider/mount/linux_spec.rb b/spec/unit/provider/mount/linux_spec.rb
index 3e41f895d1..4f25367c53 100644
--- a/spec/unit/provider/mount/linux_spec.rb
+++ b/spec/unit/provider/mount/linux_spec.rb
@@ -5,7 +5,7 @@ describe Chef::Provider::Mount::Linux do
let(:run_context) do
node = Chef::Node.new
events = Chef::EventDispatch::Dispatcher.new
- run_context = Chef::RunContext.new(node, {}, events)
+ Chef::RunContext.new(node, {}, events)
end
let(:new_resource) do
@@ -22,9 +22,10 @@ describe Chef::Provider::Mount::Linux do
end
before(:each) do
- allow(::File).to receive(:exists?).with("/dev/sdz1").and_return true
- allow(::File).to receive(:exists?).with("/tmp/foo").and_return true
- allow(::File).to receive(:exists?).with("//192.168.11.102/Share/backup").and_return true
+ allow(::File).to receive(:exist?).with("/etc/fstab").and_return false
+ allow(::File).to receive(:exist?).with("/dev/sdz1").and_return true
+ allow(::File).to receive(:exist?).with("/tmp/foo").and_return true
+ allow(::File).to receive(:exist?).with("//192.168.11.102/Share/backup").and_return true
allow(::File).to receive(:realpath).with("/dev/sdz1").and_return "/dev/sdz1"
allow(::File).to receive(:realpath).with("/tmp/foo").and_return "/tmp/foo"
end
diff --git a/spec/unit/provider/mount/mount_spec.rb b/spec/unit/provider/mount/mount_spec.rb
index 9a7d9198b5..1985b52ca0 100644
--- a/spec/unit/provider/mount/mount_spec.rb
+++ b/spec/unit/provider/mount/mount_spec.rb
@@ -34,8 +34,8 @@ describe Chef::Provider::Mount::Mount do
@provider = Chef::Provider::Mount::Mount.new(@new_resource, @run_context)
- allow(::File).to receive(:exists?).with("/dev/sdz1").and_return true
- allow(::File).to receive(:exists?).with("/tmp/foo").and_return true
+ allow(::File).to receive(:exist?).with("/dev/sdz1").and_return true
+ allow(::File).to receive(:exist?).with("/tmp/foo").and_return true
allow(::File).to receive(:realpath).with("/dev/sdz1").and_return "/dev/sdz1"
allow(::File).to receive(:realpath).with("/tmp/foo").and_return "/tmp/foo"
end
@@ -82,12 +82,12 @@ describe Chef::Provider::Mount::Mount do
end
it "should raise an error if the mount device does not exist" do
- allow(::File).to receive(:exists?).with("/dev/sdz1").and_return false
+ allow(::File).to receive(:exist?).with("/dev/sdz1").and_return false
expect { @provider.load_current_resource; @provider.mountable? }.to raise_error(Chef::Exceptions::Mount)
end
it "should not call mountable? with load_current_resource - CHEF-1565" do
- allow(::File).to receive(:exists?).with("/dev/sdz1").and_return false
+ allow(::File).to receive(:exist?).with("/dev/sdz1").and_return false
expect(@provider).to receive(:mounted?).and_return(true)
expect(@provider).to receive(:enabled?).and_return(true)
expect(@provider).not_to receive(:mountable?)
@@ -99,12 +99,12 @@ describe Chef::Provider::Mount::Mount do
@new_resource.device_type :uuid
@new_resource.device "d21afe51-a0fe-4dc6-9152-ac733763ae0a"
expect(@provider).to receive(:shell_out_compacted).with("/sbin/findfs", "UUID=d21afe51-a0fe-4dc6-9152-ac733763ae0a").and_return(status)
- expect(::File).to receive(:exists?).with("").and_return(false)
+ expect(::File).to receive(:exist?).with("").and_return(false)
expect { @provider.load_current_resource; @provider.mountable? }.to raise_error(Chef::Exceptions::Mount)
end
it "should raise an error if the mount point does not exist" do
- allow(::File).to receive(:exists?).with("/tmp/foo").and_return false
+ allow(::File).to receive(:exist?).with("/tmp/foo").and_return false
expect { @provider.load_current_resource; @provider.mountable? }.to raise_error(Chef::Exceptions::Mount)
end
diff --git a/spec/unit/provider/package/rpm_spec.rb b/spec/unit/provider/package/rpm_spec.rb
index edf39b0f3f..d42e3061bc 100644
--- a/spec/unit/provider/package/rpm_spec.rb
+++ b/spec/unit/provider/package/rpm_spec.rb
@@ -41,7 +41,7 @@ describe Chef::Provider::Package::Rpm do
let(:rpm_q_status) { instance_double("Mixlib::ShellOut", exitstatus: rpm_q_exitstatus, stdout: rpm_q_stdout) }
before(:each) do
- allow(::File).to receive(:exist?).with("PLEASE STUB File.exists? EXACTLY").and_return(true)
+ allow(::File).to receive(:exist?).with("PLEASE STUB File.exist? EXACTLY").and_return(true)
# Ensure all shell out usage is stubbed with exact arguments
allow(provider).to receive(:shell_out_compacted!).with("PLEASE STUB YOUR SHELLOUT CALLS").and_return(nil)
diff --git a/spec/unit/provider/template_spec.rb b/spec/unit/provider/template_spec.rb
index 84cbfc5d08..e6e251bc22 100644
--- a/spec/unit/provider/template_spec.rb
+++ b/spec/unit/provider/template_spec.rb
@@ -50,7 +50,7 @@ describe Chef::Provider::Template do
let(:content) do
content = double("Chef::Provider::File::Content::Template", template_location: "/foo/bar/baz")
- allow(File).to receive(:exists?).with("/foo/bar/baz").and_return(true)
+ allow(File).to receive(:exist?).with("/foo/bar/baz").and_return(true)
content
end
@@ -76,7 +76,7 @@ describe Chef::Provider::Template do
it "stops executing when the local template source can't be found" do
setup_normal_file
allow(content).to receive(:template_location).and_return("/baz/bar/foo")
- allow(File).to receive(:exists?).with("/baz/bar/foo").and_return(false)
+ allow(File).to receive(:exist?).with("/baz/bar/foo").and_return(false)
expect { provider.run_action(:create) }.to raise_error Chef::Mixin::WhyRun::ResourceRequirements::Assertion::AssertionFailure
end