diff options
author | Claire McQuin <claire@getchef.com> | 2014-10-29 15:14:22 -0700 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-10-29 15:59:04 -0700 |
commit | 5fed7a65a2f024d964ecf2de1bcf2911cf8a600c (patch) | |
tree | 14cc6968e4fe4fd2485c0211088b25c645a80a4b /spec/unit/provider | |
parent | b92c309b0f1aa0837f76ab89d6c81c36076ceca9 (diff) | |
download | chef-5fed7a65a2f024d964ecf2de1bcf2911cf8a600c.tar.gz |
Update to RSpec 3.
Diffstat (limited to 'spec/unit/provider')
38 files changed, 281 insertions, 281 deletions
diff --git a/spec/unit/provider/directory_spec.rb b/spec/unit/provider/directory_spec.rb index 33df776ed4..98f860bc75 100644 --- a/spec/unit/provider/directory_spec.rb +++ b/spec/unit/provider/directory_spec.rb @@ -42,7 +42,7 @@ describe Chef::Provider::Directory do end it "describes the directory's access rights" do - pending + skip end end diff --git a/spec/unit/provider/dsc_script_spec.rb b/spec/unit/provider/dsc_script_spec.rb index dab2007920..d018c8ad54 100644 --- a/spec/unit/provider/dsc_script_spec.rb +++ b/spec/unit/provider/dsc_script_spec.rb @@ -39,21 +39,21 @@ describe Chef::Provider::DscScript do it "describes the resource as converged if there were 0 DSC resources" do allow(provider).to receive(:run_configuration).with(:test).and_return([]) provider.load_current_resource - expect(provider.instance_variable_get('@resource_converged')).to be_true + expect(provider.instance_variable_get('@resource_converged')).to be_truthy end it "describes the resource as not converged if there is 1 DSC resources that is converged" do dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resource', false, ['nothing will change something']) allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info]) provider.load_current_resource - expect(provider.instance_variable_get('@resource_converged')).to be_true + expect(provider.instance_variable_get('@resource_converged')).to be_truthy end it "describes the resource as not converged if there is 1 DSC resources that is not converged" do dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resource', true, ['will change something']) allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info]) provider.load_current_resource - expect(provider.instance_variable_get('@resource_converged')).to be_false + expect(provider.instance_variable_get('@resource_converged')).to be_falsey end it "describes the resource as not converged if there are any DSC resources that are not converged" do @@ -62,7 +62,7 @@ describe Chef::Provider::DscScript do allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info1, dsc_resource_info2]) provider.load_current_resource - expect(provider.instance_variable_get('@resource_converged')).to be_false + expect(provider.instance_variable_get('@resource_converged')).to be_falsey end it "describes the resource as converged if all DSC resources that are converged" do @@ -71,7 +71,7 @@ describe Chef::Provider::DscScript do allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info1, dsc_resource_info2]) provider.load_current_resource - expect(provider.instance_variable_get('@resource_converged')).to be_true + expect(provider.instance_variable_get('@resource_converged')).to be_truthy end end diff --git a/spec/unit/provider/env_spec.rb b/spec/unit/provider/env_spec.rb index 22fed4b7ac..19233dfba9 100644 --- a/spec/unit/provider/env_spec.rb +++ b/spec/unit/provider/env_spec.rb @@ -30,7 +30,7 @@ describe Chef::Provider::Env do end it "assumes the key_name exists by default" do - expect(@provider.key_exists).to be_true + expect(@provider.key_exists).to be_truthy end describe "when loading the current status" do @@ -55,13 +55,13 @@ describe Chef::Provider::Env do it "should check if the key_name exists" do expect(@provider).to receive(:env_key_exists).with("FOO").and_return(true) @provider.load_current_resource - expect(@provider.key_exists).to be_true + expect(@provider.key_exists).to be_truthy end it "should flip the value of exists if the key does not exist" do expect(@provider).to receive(:env_key_exists).with("FOO").and_return(false) @provider.load_current_resource - expect(@provider.key_exists).to be_false + expect(@provider.key_exists).to be_falsey end it "should return the current resource" do @@ -230,25 +230,25 @@ describe Chef::Provider::Env do end it "should return false if the values are equal" do - expect(@provider.requires_modify_or_create?).to be_false + expect(@provider.requires_modify_or_create?).to be_falsey end it "should return true if the values not are equal" do @new_resource.value("C:/elsewhere") - expect(@provider.requires_modify_or_create?).to be_true + expect(@provider.requires_modify_or_create?).to be_truthy end it "should return false if the current value contains the element" do @new_resource.delim(";") @current_resource.value("C:/bar;C:/foo;C:/baz") - expect(@provider.requires_modify_or_create?).to be_false + expect(@provider.requires_modify_or_create?).to be_falsey end it "should return true if the current value does not contain the element" do @new_resource.delim(";") @current_resource.value("C:/biz;C:/foo/bin;C:/baz") - expect(@provider.requires_modify_or_create?).to be_true + expect(@provider.requires_modify_or_create?).to be_truthy end context "when new_resource's value contains the delimiter" do @@ -256,14 +256,14 @@ describe Chef::Provider::Env do @new_resource.value("C:/biz;C:/baz") @new_resource.delim(";") @current_resource.value("C:/biz;C:/foo/bin;C:/baz") - expect(@provider.requires_modify_or_create?).to be_false + expect(@provider.requires_modify_or_create?).to be_falsey end it "should return true if any of the new values are not contained" do @new_resource.value("C:/biz;C:/baz;C:/bin") @new_resource.delim(";") @current_resource.value("C:/biz;C:/foo/bin;C:/baz") - expect(@provider.requires_modify_or_create?).to be_true + expect(@provider.requires_modify_or_create?).to be_truthy end end end diff --git a/spec/unit/provider/file/content_spec.rb b/spec/unit/provider/file/content_spec.rb index 0f2fd6632c..db0753bf8c 100644 --- a/spec/unit/provider/file/content_spec.rb +++ b/spec/unit/provider/file/content_spec.rb @@ -66,14 +66,14 @@ describe Chef::Provider::File::Content do it "returns a tempfile in the tempdir when :file_staging_uses_destdir is not set" do Chef::Config[:file_staging_uses_destdir] = false - expect(content.tempfile.path.start_with?(Dir::tmpdir)).to be_true - expect(canonicalize_path(content.tempfile.path).start_with?(enclosing_directory)).to be_false + expect(content.tempfile.path.start_with?(Dir::tmpdir)).to be_truthy + expect(canonicalize_path(content.tempfile.path).start_with?(enclosing_directory)).to be_falsey end it "returns a tempfile in the destdir when :file_desployment_uses_destdir is not set" do Chef::Config[:file_staging_uses_destdir] = true - expect(content.tempfile.path.start_with?(Dir::tmpdir)).to be_false - expect(canonicalize_path(content.tempfile.path).start_with?(enclosing_directory)).to be_true + expect(content.tempfile.path.start_with?(Dir::tmpdir)).to be_falsey + expect(canonicalize_path(content.tempfile.path).start_with?(enclosing_directory)).to be_truthy end end diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb index bfbf531389..1e282c098d 100644 --- a/spec/unit/provider/git_spec.rb +++ b/spec/unit/provider/git_spec.rb @@ -621,21 +621,21 @@ SHAS describe "when check remote command returns with status 2" do it "returns true" do allow(@command_response).to receive(:exitstatus) { 2 } - expect(@provider.multiple_remotes?(@command_response)).to be_true + expect(@provider.multiple_remotes?(@command_response)).to be_truthy end end describe "when check remote command returns with status 0" do it "returns false" do allow(@command_response).to receive(:exitstatus) { 0 } - expect(@provider.multiple_remotes?(@command_response)).to be_false + expect(@provider.multiple_remotes?(@command_response)).to be_falsey end end describe "when check remote command returns with status 0" do it "returns false" do allow(@command_response).to receive(:exitstatus) { 1 } - expect(@provider.multiple_remotes?(@command_response)).to be_false + expect(@provider.multiple_remotes?(@command_response)).to be_falsey end end end @@ -649,7 +649,7 @@ SHAS it "returns true" do allow(@command_response).to receive(:exitstatus) { 0 } allow(@command_response).to receive(:stdout) { @resource.repository } - expect(@provider.remote_matches?(@resource.repository, @command_response)).to be_true + expect(@provider.remote_matches?(@resource.repository, @command_response)).to be_truthy end end @@ -657,7 +657,7 @@ SHAS it "returns false" do allow(@command_response).to receive(:exitstatus) { 0 } allow(@command_response).to receive(:stdout) { @resource.repository + "test" } - expect(@provider.remote_matches?(@resource.repository, @command_response)).to be_false + expect(@provider.remote_matches?(@resource.repository, @command_response)).to be_falsey end end end diff --git a/spec/unit/provider/group/dscl_spec.rb b/spec/unit/provider/group/dscl_spec.rb index acd1ba3859..e09365a828 100644 --- a/spec/unit/provider/group/dscl_spec.rb +++ b/spec/unit/provider/group/dscl_spec.rb @@ -129,15 +129,15 @@ describe Chef::Provider::Group::Dscl do end it "should return true for a used gid number" do - expect(@provider.gid_used?(500)).to be_true + expect(@provider.gid_used?(500)).to be_truthy end it "should return false for an unused gid number" do - expect(@provider.gid_used?(501)).to be_false + expect(@provider.gid_used?(501)).to be_falsey end it "should return false if not given any valid gid number" do - expect(@provider.gid_used?(nil)).to be_false + expect(@provider.gid_used?(nil)).to be_falsey end end diff --git a/spec/unit/provider/group_spec.rb b/spec/unit/provider/group_spec.rb index e20486fd4a..b36bfe364b 100644 --- a/spec/unit/provider/group_spec.rb +++ b/spec/unit/provider/group_spec.rb @@ -45,7 +45,7 @@ describe Chef::Provider::User do end it "assumes the group exists by default" do - expect(@provider.group_exists).to be_true + expect(@provider.group_exists).to be_truthy end describe "when establishing the current state of the group" do @@ -76,7 +76,7 @@ describe Chef::Provider::User do it "should flip the value of exists if it cannot be found in /etc/group" do allow(Etc).to receive(:getgrnam).and_raise(ArgumentError) @provider.load_current_resource - expect(@provider.group_exists).to be_false + expect(@provider.group_exists).to be_falsey end it "should return the current resource" do @@ -88,42 +88,42 @@ describe Chef::Provider::User do [ :gid, :members ].each do |attribute| it "should return true if #{attribute} doesn't match" do allow(@current_resource).to receive(attribute).and_return("looooooooooooooooooool") - expect(@provider.compare_group).to be_true + expect(@provider.compare_group).to be_truthy end end it "should return false if gid and members are equal" do - expect(@provider.compare_group).to be_false + expect(@provider.compare_group).to be_falsey end it "should coerce an integer to a string for comparison" do allow(@current_resource).to receive(:gid).and_return("500") - expect(@provider.compare_group).to be_false + expect(@provider.compare_group).to be_falsey end it "should return false if append is true and the group member(s) already exists" do @current_resource.members << "extra_user" allow(@new_resource).to receive(:append).and_return(true) - expect(@provider.compare_group).to be_false + expect(@provider.compare_group).to be_falsey end it "should return true if append is true and the group member(s) do not already exist" do @new_resource.members << "extra_user" allow(@new_resource).to receive(:append).and_return(true) - expect(@provider.compare_group).to be_true + expect(@provider.compare_group).to be_truthy end it "should return false if append is true and excluded_members include a non existing member" do @new_resource.excluded_members << "extra_user" allow(@new_resource).to receive(:append).and_return(true) - expect(@provider.compare_group).to be_false + expect(@provider.compare_group).to be_falsey end it "should return true if the append is true and excluded_members include an existing user" do @new_resource.members.each {|m| @new_resource.excluded_members << m } @new_resource.members.clear allow(@new_resource).to receive(:append).and_return(true) - expect(@provider.compare_group).to be_true + expect(@provider.compare_group).to be_truthy end end @@ -259,26 +259,26 @@ describe Chef::Provider::User do @new_resource.members << "user1" @new_resource.members << "user2" allow(@new_resource).to receive(:append).and_return true - expect(@provider.compare_group).to be_true + expect(@provider.compare_group).to be_truthy expect(@provider.change_desc).to eq([ "add missing member(s): user1, user2" ]) end it "should report that the group members will be overwritten if not appending" do @new_resource.members << "user1" allow(@new_resource).to receive(:append).and_return false - expect(@provider.compare_group).to be_true + expect(@provider.compare_group).to be_truthy expect(@provider.change_desc).to eq([ "replace group members with new list of members" ]) end it "should report the gid will be changed when it does not match" do allow(@current_resource).to receive(:gid).and_return("BADF00D") - expect(@provider.compare_group).to be_true + expect(@provider.compare_group).to be_truthy expect(@provider.change_desc).to eq([ "change gid #{@current_resource.gid} to #{@new_resource.gid}" ]) end it "should report no change reason when no change is required" do - expect(@provider.compare_group).to be_false + expect(@provider.compare_group).to be_falsey expect(@provider.change_desc).to eq([ ]) end end diff --git a/spec/unit/provider/ifconfig/debian_spec.rb b/spec/unit/provider/ifconfig/debian_spec.rb index 160a0ed4eb..351e734040 100644 --- a/spec/unit/provider/ifconfig/debian_spec.rb +++ b/spec/unit/provider/ifconfig/debian_spec.rb @@ -77,29 +77,29 @@ describe Chef::Provider::Ifconfig::Debian do context "when the interface_dot_d directory does not exist" do before do FileUtils.rmdir tempdir_path - expect(File.exists?(tempdir_path)).to be_false + expect(File.exists?(tempdir_path)).to be_falsey end it "should create the /etc/network/interfaces.d directory" do provider.run_action(:add) - expect(File.exists?(tempdir_path)).to be_true - expect(File.directory?(tempdir_path)).to be_true + expect(File.exists?(tempdir_path)).to be_truthy + expect(File.directory?(tempdir_path)).to be_truthy end it "should mark the resource as updated" do provider.run_action(:add) - expect(new_resource.updated_by_last_action?).to be_true + expect(new_resource.updated_by_last_action?).to be_truthy end end context "when the interface_dot_d directory exists" do before do - expect(File.exists?(tempdir_path)).to be_true + expect(File.exists?(tempdir_path)).to be_truthy end it "should still mark the resource as updated (we still write a file to it)" do provider.run_action(:add) - expect(new_resource.updated_by_last_action?).to be_true + expect(new_resource.updated_by_last_action?).to be_truthy end end end @@ -120,7 +120,7 @@ iface eth0 inet static netmask 255.255.254.0 EOF ) - expect(File.exists?(tempdir_path)).to be_true # since the file exists, the enclosing dir must also exist + expect(File.exists?(tempdir_path)).to be_truthy # since the file exists, the enclosing dir must also exist end context "when the /etc/network/interfaces file has the source line" do @@ -147,7 +147,7 @@ EOF it "should not mark the resource as updated" do provider.run_action(:add) pending "superclass ifconfig provider is not idempotent" - expect(new_resource.updated_by_last_action?).to be_false + expect(new_resource.updated_by_last_action?).to be_falsey end end @@ -175,7 +175,7 @@ EOF it "should mark the resource as updated" do provider.run_action(:add) - expect(new_resource.updated_by_last_action?).to be_true + expect(new_resource.updated_by_last_action?).to be_truthy end end end @@ -215,28 +215,28 @@ EOF context "when the interface_dot_d directory does not exist" do before do FileUtils.rmdir tempdir_path - expect(File.exists?(tempdir_path)).to be_false + expect(File.exists?(tempdir_path)).to be_falsey end it "should not create the /etc/network/interfaces.d directory" do provider.run_action(:add) - expect(File.exists?(tempdir_path)).not_to be_true + expect(File.exists?(tempdir_path)).not_to be_truthy end it "should mark the resource as updated" do provider.run_action(:add) - expect(new_resource.updated_by_last_action?).to be_true + expect(new_resource.updated_by_last_action?).to be_truthy end end context "when the interface_dot_d directory exists" do before do - expect(File.exists?(tempdir_path)).to be_true + expect(File.exists?(tempdir_path)).to be_truthy end it "should still mark the resource as updated (we still write a file to it)" do provider.run_action(:add) - expect(new_resource.updated_by_last_action?).to be_true + expect(new_resource.updated_by_last_action?).to be_truthy end end end @@ -258,7 +258,7 @@ iface eth0 inet static EOF ) expect(File).not_to receive(:new).with(config_filename_ifcfg, "w") - expect(File.exists?(tempdir_path)).to be_true # since the file exists, the enclosing dir must also exist + expect(File.exists?(tempdir_path)).to be_truthy # since the file exists, the enclosing dir must also exist end context "when the /etc/network/interfaces file has the source line" do @@ -283,7 +283,7 @@ another line it "should not mark the resource as updated" do provider.run_action(:add) pending "superclass ifconfig provider is not idempotent" - expect(new_resource.updated_by_last_action?).to be_false + expect(new_resource.updated_by_last_action?).to be_falsey end end @@ -308,7 +308,7 @@ source #{tempdir_path}/* it "should mark the resource as updated" do provider.run_action(:add) - expect(new_resource.updated_by_last_action?).to be_true + expect(new_resource.updated_by_last_action?).to be_truthy end end end @@ -345,9 +345,9 @@ source #{tempdir_path}/* # internal implementation detail of Ifconfig. expect_any_instance_of(Chef::Provider::File).to receive(:action_delete).and_call_original - expect(File.exist?(config_filename_ifcfg)).to be_true + expect(File.exist?(config_filename_ifcfg)).to be_truthy provider.run_action(:delete) - expect(File.exist?(config_filename_ifcfg)).to be_false + expect(File.exist?(config_filename_ifcfg)).to be_falsey end end diff --git a/spec/unit/provider/link_spec.rb b/spec/unit/provider/link_spec.rb index 3ae8a71cff..ab5b439eac 100644 --- a/spec/unit/provider/link_spec.rb +++ b/spec/unit/provider/link_spec.rb @@ -68,7 +68,7 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do expect(provider.current_resource.link_type).to eq(:symbolic) end it "should update the source of the existing link with the links target" do - expect(paths_eql?(provider.current_resource.to, "#{CHEF_SPEC_DATA}/fofile")).to be_true + expect(paths_eql?(provider.current_resource.to, "#{CHEF_SPEC_DATA}/fofile")).to be_truthy end it "should set the owner" do expect(provider.current_resource.owner).to eq(501) @@ -110,7 +110,7 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do expect(provider.current_resource.link_type).to eq(:symbolic) end it "should update the source of the existing link to the link's target" do - expect(paths_eql?(provider.current_resource.to, "#{CHEF_SPEC_DATA}/fofile")).to be_true + expect(paths_eql?(provider.current_resource.to, "#{CHEF_SPEC_DATA}/fofile")).to be_truthy end it "should not set the owner" do expect(provider.current_resource.owner).to be_nil @@ -221,7 +221,7 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do expect(provider.current_resource.link_type).to eq(:hard) end it "should update the source of the existing link to the link's target" do - expect(paths_eql?(provider.current_resource.to, "#{CHEF_SPEC_DATA}/fofile")).to be_true + expect(paths_eql?(provider.current_resource.to, "#{CHEF_SPEC_DATA}/fofile")).to be_truthy end it "should not set the owner" do expect(provider.current_resource.owner).to eq(nil) diff --git a/spec/unit/provider/mdadm_spec.rb b/spec/unit/provider/mdadm_spec.rb index ddff49da13..77ed5798a8 100644 --- a/spec/unit/provider/mdadm_spec.rb +++ b/spec/unit/provider/mdadm_spec.rb @@ -41,13 +41,13 @@ describe Chef::Provider::Mdadm do it "determines that the metadevice exists when mdadm exit code is zero" do allow(@provider).to receive(:shell_out!).with("mdadm --detail --test /dev/md1", :returns => [0,4]).and_return(OpenStruct.new(:status => 0)) @provider.load_current_resource - expect(@provider.current_resource.exists).to be_true + expect(@provider.current_resource.exists).to be_truthy end it "determines that the metadevice does not exist when mdadm exit code is 4" do allow(@provider).to receive(:shell_out!).with("mdadm --detail --test /dev/md1", :returns => [0,4]).and_return(OpenStruct.new(:status => 4)) @provider.load_current_resource - expect(@provider.current_resource.exists).to be_false + expect(@provider.current_resource.exists).to be_falsey end end diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb index cdf4e0555d..ca0ddd006c 100644 --- a/spec/unit/provider/mount/aix_spec.rb +++ b/spec/unit/provider/mount/aix_spec.rb @@ -84,7 +84,7 @@ ENABLED stub_mounted_enabled(@provider, @mounted_output, "") @provider.load_current_resource - expect(@provider.current_resource.mounted).to be_true + expect(@provider.current_resource.mounted).to be_truthy end it "should set current_resource.mounted to false if device is not mounted" do @@ -92,7 +92,7 @@ ENABLED @provider.load_current_resource - expect(@provider.current_resource.mounted).to be_false + expect(@provider.current_resource.mounted).to be_falsey end it "should set current_resource.mounted to false if the mount point is used for another device" do @@ -100,7 +100,7 @@ ENABLED @provider.load_current_resource - expect(@provider.current_resource.mounted).to be_false + expect(@provider.current_resource.mounted).to be_falsey end end @@ -110,8 +110,8 @@ ENABLED @provider.load_current_resource - expect(@provider.current_resource.enabled).to be_true - expect(@provider.current_resource.mounted).to be_true + expect(@provider.current_resource.enabled).to be_truthy + expect(@provider.current_resource.mounted).to be_truthy expect(@provider.current_resource.mount_point).to eql(@new_resource.mount_point) expect(@provider.current_resource.fstype).to eql("jfs2") expect(@provider.current_resource.options).to eql(['rw']) diff --git a/spec/unit/provider/mount/mount_spec.rb b/spec/unit/provider/mount/mount_spec.rb index 40cfbcaf39..7e9531a8ac 100644 --- a/spec/unit/provider/mount/mount_spec.rb +++ b/spec/unit/provider/mount/mount_spec.rb @@ -67,14 +67,14 @@ describe Chef::Provider::Mount::Mount do "cifs" => "//cifsserver/share" }.each do |type, fs_spec| it "should detect network fs_spec (#{type})" do @new_resource.device fs_spec - expect(@provider.network_device?).to be_true + expect(@provider.network_device?).to be_truthy end it "should ignore trailing slash and set mounted to true for network mount (#{type})" do @new_resource.device fs_spec allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "#{fs_spec}/ on /tmp/foo type #{type} (rw)\n")) @provider.load_current_resource - expect(@provider.current_resource.mounted).to be_true + expect(@provider.current_resource.mounted).to be_truthy end end end @@ -123,13 +123,13 @@ describe Chef::Provider::Mount::Mount do it "should set mounted true if the mount point is found in the mounts list" do allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "/dev/sdz1 on /tmp/foo type ext3 (rw)\n")) @provider.load_current_resource() - expect(@provider.current_resource.mounted).to be_true + expect(@provider.current_resource.mounted).to be_truthy end it "should set mounted false if another mount point beginning with the same path is found in the mounts list" do allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "/dev/sdz1 on /tmp/foobar type ext3 (rw)\n")) @provider.load_current_resource() - expect(@provider.current_resource.mounted).to be_false + expect(@provider.current_resource.mounted).to be_falsey end it "should set mounted true if the symlink target of the device is found in the mounts list" do @@ -141,7 +141,7 @@ describe Chef::Provider::Mount::Mount do allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "#{target} on /tmp/foo type ext3 (rw)\n")) @provider.load_current_resource() - expect(@provider.current_resource.mounted).to be_true + expect(@provider.current_resource.mounted).to be_truthy end it "should set mounted true if the symlink target of the device is relative and is found in the mounts list - CHEF-4957" do @@ -155,7 +155,7 @@ describe Chef::Provider::Mount::Mount do allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "#{absolute_target} on /tmp/foo type ext3 (rw)\n")) @provider.load_current_resource() - expect(@provider.current_resource.mounted).to be_true + expect(@provider.current_resource.mounted).to be_truthy end it "should set mounted true if the mount point is found last in the mounts list" do @@ -164,7 +164,7 @@ describe Chef::Provider::Mount::Mount do allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => mount)) @provider.load_current_resource() - expect(@provider.current_resource.mounted).to be_true + expect(@provider.current_resource.mounted).to be_truthy end it "should set mounted false if the mount point is not last in the mounts list" do @@ -173,13 +173,13 @@ describe Chef::Provider::Mount::Mount do allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => mount)) @provider.load_current_resource() - expect(@provider.current_resource.mounted).to be_false + expect(@provider.current_resource.mounted).to be_falsey end it "mounted should be false if the mount point is not found in the mounts list" do allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "/dev/sdy1 on /tmp/foo type ext3 (rw)\n")) @provider.load_current_resource() - expect(@provider.current_resource.mounted).to be_false + expect(@provider.current_resource.mounted).to be_falsey end it "should set enabled to true if the mount point is last in fstab" do @@ -189,7 +189,7 @@ describe Chef::Provider::Mount::Mount do allow(::File).to receive(:foreach).with("/etc/fstab").and_yield(fstab1).and_yield(fstab2) @provider.load_current_resource - expect(@provider.current_resource.enabled).to be_true + expect(@provider.current_resource.enabled).to be_truthy end it "should set enabled to true if the mount point is not last in fstab and mount_point is a substring of another mount" do @@ -199,7 +199,7 @@ describe Chef::Provider::Mount::Mount do allow(::File).to receive(:foreach).with("/etc/fstab").and_yield(fstab1).and_yield(fstab2) @provider.load_current_resource - expect(@provider.current_resource.enabled).to be_true + expect(@provider.current_resource.enabled).to be_truthy end it "should set enabled to true if the symlink target is in fstab" do @@ -213,7 +213,7 @@ describe Chef::Provider::Mount::Mount do allow(::File).to receive(:foreach).with("/etc/fstab").and_yield fstab @provider.load_current_resource - expect(@provider.current_resource.enabled).to be_true + expect(@provider.current_resource.enabled).to be_truthy end it "should set enabled to true if the symlink target is relative and is in fstab - CHEF-4957" do @@ -227,7 +227,7 @@ describe Chef::Provider::Mount::Mount do allow(::File).to receive(:foreach).with("/etc/fstab").and_yield fstab @provider.load_current_resource - expect(@provider.current_resource.enabled).to be_true + expect(@provider.current_resource.enabled).to be_truthy end it "should set enabled to false if the mount point is not in fstab" do @@ -235,7 +235,7 @@ describe Chef::Provider::Mount::Mount do allow(::File).to receive(:foreach).with("/etc/fstab").and_yield fstab @provider.load_current_resource - expect(@provider.current_resource.enabled).to be_false + expect(@provider.current_resource.enabled).to be_falsey end it "should ignore commented lines in fstab " do @@ -243,7 +243,7 @@ describe Chef::Provider::Mount::Mount do allow(::File).to receive(:foreach).with("/etc/fstab").and_yield fstab @provider.load_current_resource - expect(@provider.current_resource.enabled).to be_false + expect(@provider.current_resource.enabled).to be_falsey end it "should set enabled to false if the mount point is not last in fstab" do @@ -252,7 +252,7 @@ describe Chef::Provider::Mount::Mount do allow(::File).to receive(:foreach).with("/etc/fstab").and_yield(line_1).and_yield(line_2) @provider.load_current_resource - expect(@provider.current_resource.enabled).to be_false + expect(@provider.current_resource.enabled).to be_falsey end it "should not mangle the mount options if the device in fstab is a symlink" do diff --git a/spec/unit/provider/mount/solaris_spec.rb b/spec/unit/provider/mount/solaris_spec.rb index 93321a8ad6..9a9b09b531 100644 --- a/spec/unit/provider/mount/solaris_spec.rb +++ b/spec/unit/provider/mount/solaris_spec.rb @@ -180,11 +180,11 @@ describe Chef::Provider::Mount::Solaris, :unix_only do end it "should set the mounted status on the current_resource" do - expect(provider.current_resource.mounted).to be_true + expect(provider.current_resource.mounted).to be_truthy end it "should set the enabled status on the current_resource" do - expect(provider.current_resource.enabled).to be_true + expect(provider.current_resource.enabled).to be_truthy end it "should set the fstype field on the current_resource" do @@ -258,7 +258,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do let(:fsck_device) { "-" } it "should work at some point in the future" do - pending "SMBFS mounts on solaris look like they will need some future code work and more investigation" + skip "SMBFS mounts on solaris look like they will need some future code work and more investigation" end end @@ -304,11 +304,11 @@ describe Chef::Provider::Mount::Solaris, :unix_only do end it "should set the mounted status on the current_resource" do - expect(provider.current_resource.mounted).to be_true + expect(provider.current_resource.mounted).to be_truthy end it "should set the enabled status on the current_resource" do - expect(provider.current_resource.enabled).to be_true + expect(provider.current_resource.enabled).to be_truthy end it "should set the fstype field on the current_resource" do @@ -322,7 +322,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do it "should set the pass field on the current_resource" do # is this correct or should it be nil? # - # vfstab man page says. + # vfstab man page says. # "A - is used to indicate no entry in a field." # 0 and - could mean different things for some file systems expect(provider.current_resource.pass).to eql(0) @@ -354,11 +354,11 @@ describe Chef::Provider::Mount::Solaris, :unix_only do end it "should set mounted true if the symlink target of the device is found in the mounts list" do - expect(provider.current_resource.mounted).to be_true + expect(provider.current_resource.mounted).to be_truthy end it "should set enabled true if the symlink target of the device is found in the vfstab" do - expect(provider.current_resource.enabled).to be_true + expect(provider.current_resource.enabled).to be_truthy end it "should have the correct mount options" do @@ -391,11 +391,11 @@ describe Chef::Provider::Mount::Solaris, :unix_only do end it "should set mounted true if the symlink target of the device is found in the mounts list" do - expect(provider.current_resource.mounted).to be_true + expect(provider.current_resource.mounted).to be_truthy end it "should set enabled true if the symlink target of the device is found in the vfstab" do - expect(provider.current_resource.enabled).to be_true + expect(provider.current_resource.enabled).to be_truthy end it "should have the correct mount options" do @@ -412,7 +412,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do } it "should set mounted true" do provider.load_current_resource() - expect(provider.current_resource.mounted).to be_true + expect(provider.current_resource.mounted).to be_truthy end end @@ -425,7 +425,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do } it "should set mounted false" do provider.load_current_resource() - expect(provider.current_resource.mounted).to be_false + expect(provider.current_resource.mounted).to be_falsey end end @@ -437,7 +437,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do } it "should set mounted false" do provider.load_current_resource() - expect(provider.current_resource.mounted).to be_false + expect(provider.current_resource.mounted).to be_falsey end end @@ -449,7 +449,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do } it "should set mounted false" do provider.load_current_resource() - expect(provider.current_resource.mounted).to be_false + expect(provider.current_resource.mounted).to be_falsey end end @@ -463,7 +463,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do it "should set enabled to true" do provider.load_current_resource - expect(provider.current_resource.enabled).to be_true + expect(provider.current_resource.enabled).to be_truthy end end @@ -477,7 +477,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do it "should set enabled to true" do provider.load_current_resource - expect(provider.current_resource.enabled).to be_true + expect(provider.current_resource.enabled).to be_truthy end end @@ -491,7 +491,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do it "should set enabled to false" do provider.load_current_resource - expect(provider.current_resource.enabled).to be_false + expect(provider.current_resource.enabled).to be_falsey end end @@ -504,7 +504,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do it "should set enabled to false" do provider.load_current_resource - expect(provider.current_resource.enabled).to be_false + expect(provider.current_resource.enabled).to be_falsey end end @@ -517,7 +517,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do it "should set enabled to false" do provider.load_current_resource - expect(provider.current_resource.enabled).to be_false + expect(provider.current_resource.enabled).to be_falsey end end @@ -530,7 +530,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do it "should set enabled to false" do provider.load_current_resource - expect(provider.current_resource.enabled).to be_false + expect(provider.current_resource.enabled).to be_falsey end end end diff --git a/spec/unit/provider/package/freebsd/pkgng_spec.rb b/spec/unit/provider/package/freebsd/pkgng_spec.rb index d314735bf0..0c1e89c7ab 100644 --- a/spec/unit/provider/package/freebsd/pkgng_spec.rb +++ b/spec/unit/provider/package/freebsd/pkgng_spec.rb @@ -33,7 +33,7 @@ describe Chef::Provider::Package::Freebsd::Port do describe "initialization" do it "should create a current resource with the name of the new resource" do - expect(@provider.current_resource.is_a?(Chef::Resource::Package)).to be_true + expect(@provider.current_resource.is_a?(Chef::Resource::Package)).to be_truthy expect(@provider.current_resource.name).to eq('zsh') end end diff --git a/spec/unit/provider/package/freebsd/port_spec.rb b/spec/unit/provider/package/freebsd/port_spec.rb index 3085b16a92..2e32e88f97 100644 --- a/spec/unit/provider/package/freebsd/port_spec.rb +++ b/spec/unit/provider/package/freebsd/port_spec.rb @@ -33,7 +33,7 @@ describe Chef::Provider::Package::Freebsd::Port do describe "initialization" do it "should create a current resource with the name of the new resource" do - expect(@provider.current_resource.is_a?(Chef::Resource::Package)).to be_true + expect(@provider.current_resource.is_a?(Chef::Resource::Package)).to be_truthy expect(@provider.current_resource.name).to eq('zsh') end end diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb index bce0054220..3ea3e841e7 100644 --- a/spec/unit/provider/package/rubygems_spec.rb +++ b/spec/unit/provider/package/rubygems_spec.rb @@ -378,7 +378,7 @@ describe Chef::Provider::Package::Rubygems do it "target_version_already_installed? should return false so that we can search for candidates" do @provider.load_current_resource - expect(@provider.target_version_already_installed?).to be_false + expect(@provider.target_version_already_installed?).to be_falsey end end @@ -495,20 +495,20 @@ describe Chef::Provider::Package::Rubygems do describe "in the current gem environment" do it "installs the gem via the gems api when no explicit options are used" do expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => nil) - expect(@provider.action_install).to be_true + expect(@provider.action_install).to be_truthy end it "installs the gem via the gems api when a remote source is provided" do @new_resource.source('http://gems.example.org') sources = ['http://gems.example.org'] expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => sources) - expect(@provider.action_install).to be_true + expect(@provider.action_install).to be_truthy end it "installs the gem from file via the gems api when no explicit options are used" do @new_resource.source(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') expect(@provider.gem_env).to receive(:install).with(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') - expect(@provider.action_install).to be_true + expect(@provider.action_install).to be_truthy end it "installs the gem from file via the gems api when the package is a path and the source is nil" do @@ -517,7 +517,7 @@ describe Chef::Provider::Package::Rubygems do @provider.current_resource = @current_resource expect(@new_resource.source).to eq(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') expect(@provider.gem_env).to receive(:install).with(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') - expect(@provider.action_install).to be_true + expect(@provider.action_install).to be_truthy end # this catches 'gem_package "foo"' when "./foo" is a file in the cwd, and instead of installing './foo' it fetches the remote gem @@ -525,20 +525,20 @@ describe Chef::Provider::Package::Rubygems do allow(::File).to receive(:exists?).and_return(true) @new_resource.package_name('rspec-core') expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => nil) - expect(@provider.action_install).to be_true + expect(@provider.action_install).to be_truthy end it "installs the gem by shelling out when options are provided as a String" do @new_resource.options('-i /alt/install/location') expected ="gem install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\" -i /alt/install/location" expect(@provider).to receive(:shell_out!).with(expected, :env => nil) - expect(@provider.action_install).to be_true + expect(@provider.action_install).to be_truthy end it "installs the gem via the gems api when options are given as a Hash" do @new_resource.options(:install_dir => '/alt/install/location') expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => nil, :install_dir => '/alt/install/location') - expect(@provider.action_install).to be_true + expect(@provider.action_install).to be_truthy end describe "at a specific version" do @@ -548,7 +548,7 @@ describe Chef::Provider::Package::Rubygems do it "installs the gem via the gems api" do expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => nil) - expect(@provider.action_install).to be_true + expect(@provider.action_install).to be_truthy end end describe "at version specified with comparison operator" do @@ -574,7 +574,7 @@ describe Chef::Provider::Package::Rubygems do it "installs the gem by shelling out to gem install" do @new_resource.gem_binary('/usr/weird/bin/gem') expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\"", :env=>nil) - expect(@provider.action_install).to be_true + expect(@provider.action_install).to be_truthy end it "installs the gem from file by shelling out to gem install" do @@ -582,7 +582,7 @@ describe Chef::Provider::Package::Rubygems do @new_resource.source(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') @new_resource.version('>= 0') expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install #{CHEF_SPEC_DATA}/gems/chef-integration-test-0.1.0.gem -q --no-rdoc --no-ri -v \">= 0\"", :env=>nil) - expect(@provider.action_install).to be_true + expect(@provider.action_install).to be_truthy end it "installs the gem from file by shelling out to gem install when the package is a path and the source is nil" do @@ -593,7 +593,7 @@ describe Chef::Provider::Package::Rubygems do @new_resource.version('>= 0') expect(@new_resource.source).to eq(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem') expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install #{CHEF_SPEC_DATA}/gems/chef-integration-test-0.1.0.gem -q --no-rdoc --no-ri -v \">= 0\"", :env=>nil) - expect(@provider.action_install).to be_true + expect(@provider.action_install).to be_truthy end end diff --git a/spec/unit/provider/package_spec.rb b/spec/unit/provider/package_spec.rb index 3a42bcacf6..2aeaf717e6 100644 --- a/spec/unit/provider/package_spec.rb +++ b/spec/unit/provider/package_spec.rb @@ -376,7 +376,7 @@ describe Chef::Provider::Package do end it "should never back up the cached response file" do - expect(@provider.preseed_resource('java', '6').backup).to be_false + expect(@provider.preseed_resource('java', '6').backup).to be_falsey end it "sets the install path of the resource to $file_cache/$cookbook/$pkg_name-$pkg_version.seed" do diff --git a/spec/unit/provider/remote_directory_spec.rb b/spec/unit/provider/remote_directory_spec.rb index a2f5092f57..4434714ebc 100644 --- a/spec/unit/provider/remote_directory_spec.rb +++ b/spec/unit/provider/remote_directory_spec.rb @@ -84,7 +84,7 @@ describe Chef::Provider::RemoteDirectory do expect(directory_resource.mode).to eq("0750") expect(directory_resource.group).to eq("wheel") expect(directory_resource.owner).to eq("root") - expect(directory_resource.recursive).to be_true + expect(directory_resource.recursive).to be_truthy end it "configures access control on files in the directory" do @@ -116,17 +116,17 @@ describe Chef::Provider::RemoteDirectory do it "creates the toplevel directory without error " do @resource.recursive(false) @provider.run_action(:create) - expect(::File.exist?(@destination_dir)).to be_true + expect(::File.exist?(@destination_dir)).to be_truthy end it "transfers the directory with all contents" do @provider.run_action(:create) - expect(::File.exist?(@destination_dir + '/remote_dir_file1.txt')).to be_true - expect(::File.exist?(@destination_dir + '/remote_dir_file2.txt')).to be_true - expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')).to be_true - expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file2.txt')).to be_true - expect(::File.exist?(@destination_dir + '/remotesubdir/.a_dotfile')).to be_true - expect(::File.exist?(@destination_dir + '/.a_dotdir/.a_dotfile_in_a_dotdir')).to be_true + expect(::File.exist?(@destination_dir + '/remote_dir_file1.txt')).to be_truthy + expect(::File.exist?(@destination_dir + '/remote_dir_file2.txt')).to be_truthy + expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')).to be_truthy + expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file2.txt')).to be_truthy + expect(::File.exist?(@destination_dir + '/remotesubdir/.a_dotfile')).to be_truthy + expect(::File.exist?(@destination_dir + '/.a_dotdir/.a_dotfile_in_a_dotdir')).to be_truthy end describe "only if it is missing" do @@ -141,8 +141,8 @@ describe Chef::Provider::RemoteDirectory do @provider.run_action(:create_if_missing) - expect(file1md5.eql?(Digest::MD5.hexdigest(File.read(@destination_dir + '/remote_dir_file1.txt')))).to be_true - expect(subdirfile1md5.eql?(Digest::MD5.hexdigest(File.read(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')))).to be_true + expect(file1md5.eql?(Digest::MD5.hexdigest(File.read(@destination_dir + '/remote_dir_file1.txt')))).to be_truthy + expect(subdirfile1md5.eql?(Digest::MD5.hexdigest(File.read(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')))).to be_truthy end end @@ -155,13 +155,13 @@ describe Chef::Provider::RemoteDirectory do FileUtils.touch(@destination_dir + '/remotesubdir/marked_for_death_again.txt') @provider.run_action(:create) - expect(::File.exist?(@destination_dir + '/remote_dir_file1.txt')).to be_true - expect(::File.exist?(@destination_dir + '/remote_dir_file2.txt')).to be_true - expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')).to be_true - expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file2.txt')).to be_true + expect(::File.exist?(@destination_dir + '/remote_dir_file1.txt')).to be_truthy + expect(::File.exist?(@destination_dir + '/remote_dir_file2.txt')).to be_truthy + expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')).to be_truthy + expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file2.txt')).to be_truthy - expect(::File.exist?(@destination_dir + '/marked_for_death.txt')).to be_false - expect(::File.exist?(@destination_dir + '/remotesubdir/marked_for_death_again.txt')).to be_false + expect(::File.exist?(@destination_dir + '/marked_for_death.txt')).to be_falsey + expect(::File.exist?(@destination_dir + '/remotesubdir/marked_for_death_again.txt')).to be_falsey end it "removes files in subdirectories before files above" do @@ -172,10 +172,10 @@ describe Chef::Provider::RemoteDirectory do FileUtils.touch(@destination_dir + '/a/multiply/nested/baz.txt') FileUtils.touch(@destination_dir + '/a/multiply/nested/directory/qux.txt') @provider.run_action(:create) - expect(::File.exist?(@destination_dir + '/a/foo.txt')).to be_false - expect(::File.exist?(@destination_dir + '/a/multiply/bar.txt')).to be_false - expect(::File.exist?(@destination_dir + '/a/multiply/nested/baz.txt')).to be_false - expect(::File.exist?(@destination_dir + '/a/multiply/nested/directory/qux.txt')).to be_false + expect(::File.exist?(@destination_dir + '/a/foo.txt')).to be_falsey + expect(::File.exist?(@destination_dir + '/a/multiply/bar.txt')).to be_falsey + expect(::File.exist?(@destination_dir + '/a/multiply/nested/baz.txt')).to be_falsey + expect(::File.exist?(@destination_dir + '/a/multiply/nested/directory/qux.txt')).to be_falsey end it "removes directory symlinks properly", :not_supported_on_win2k3 do @@ -188,12 +188,12 @@ describe Chef::Provider::RemoteDirectory do Dir.mktmpdir do |tmp_dir| begin @fclass.file_class.symlink(tmp_dir.dup, symlinked_dir_path) - expect(::File.exist?(symlinked_dir_path)).to be_true + expect(::File.exist?(symlinked_dir_path)).to be_truthy @provider.run_action - expect(::File.exist?(symlinked_dir_path)).to be_false - expect(::File.exist?(tmp_dir)).to be_true + expect(::File.exist?(symlinked_dir_path)).to be_falsey + expect(::File.exist?(tmp_dir)).to be_truthy rescue Chef::Exceptions::Win32APIError => e pending "This must be run as an Administrator to create symlinks" end @@ -212,8 +212,8 @@ describe Chef::Provider::RemoteDirectory do file1md5 = Digest::MD5.hexdigest(::File.read(@destination_dir + '/remote_dir_file1.txt')) subdirfile1md5 = Digest::MD5.hexdigest(::File.read(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')) @provider.run_action(:create) - expect(file1md5.eql?(Digest::MD5.hexdigest(::File.read(@destination_dir + '/remote_dir_file1.txt')))).to be_true - expect(subdirfile1md5.eql?(Digest::MD5.hexdigest(::File.read(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')))).to be_true + expect(file1md5.eql?(Digest::MD5.hexdigest(::File.read(@destination_dir + '/remote_dir_file1.txt')))).to be_truthy + expect(subdirfile1md5.eql?(Digest::MD5.hexdigest(::File.read(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')))).to be_truthy end end diff --git a/spec/unit/provider/remote_file/ftp_spec.rb b/spec/unit/provider/remote_file/ftp_spec.rb index b3a3fcf376..dbbddd8e84 100644 --- a/spec/unit/provider/remote_file/ftp_spec.rb +++ b/spec/unit/provider/remote_file/ftp_spec.rb @@ -60,7 +60,7 @@ describe Chef::Provider::RemoteFile::FTP do let(:uri) { URI.parse("ftp://opscode.com/seattle.txt") } before(:each) do - allow(Net::FTP).to receive(:new).with().and_return(ftp) + allow(Net::FTP).to receive(:new).with(no_args).and_return(ftp) allow(Tempfile).to receive(:new).and_return(tempfile) end @@ -89,13 +89,13 @@ describe Chef::Provider::RemoteFile::FTP do it "does not use passive mode when new_resource sets ftp_active_mode to true" do new_resource.ftp_active_mode(true) fetcher = Chef::Provider::RemoteFile::FTP.new(uri, new_resource, current_resource) - expect(fetcher.use_passive_mode?).to be_false + expect(fetcher.use_passive_mode?).to be_falsey end it "uses passive mode when new_resource sets ftp_active_mode to false" do new_resource.ftp_active_mode(false) fetcher = Chef::Provider::RemoteFile::FTP.new(uri, new_resource, current_resource) - expect(fetcher.use_passive_mode?).to be_true + expect(fetcher.use_passive_mode?).to be_truthy end end diff --git a/spec/unit/provider/route_spec.rb b/spec/unit/provider/route_spec.rb index e63029ad07..ff68eea895 100644 --- a/spec/unit/provider/route_spec.rb +++ b/spec/unit/provider/route_spec.rb @@ -65,7 +65,7 @@ describe Chef::Provider::Route do provider = Chef::Provider::Route.new(resource, @run_context) provider.load_current_resource - expect(provider.is_running).to be_false + expect(provider.is_running).to be_falsey end it "should detect existing routes and set is_running attribute correctly" do @@ -75,7 +75,7 @@ describe Chef::Provider::Route do provider = Chef::Provider::Route.new(resource, @run_context) provider.load_current_resource - expect(provider.is_running).to be_true + expect(provider.is_running).to be_truthy end it "should use gateway value when matching routes" do @@ -85,7 +85,7 @@ describe Chef::Provider::Route do provider = Chef::Provider::Route.new(resource, @run_context) provider.load_current_resource - expect(provider.is_running).to be_false + expect(provider.is_running).to be_falsey end end end diff --git a/spec/unit/provider/script_spec.rb b/spec/unit/provider/script_spec.rb index 7dc8588397..4979475b79 100644 --- a/spec/unit/provider/script_spec.rb +++ b/spec/unit/provider/script_spec.rb @@ -42,7 +42,7 @@ describe Chef::Provider::Script, "action_run" do it "unlinks the tempfile when finished" do tempfile_path = @provider.script_file.path @provider.unlink_script_file - expect(File.exist?(tempfile_path)).to be_false + expect(File.exist?(tempfile_path)).to be_falsey end it "sets the owner and group for the script file" do diff --git a/spec/unit/provider/service/aix_service_spec.rb b/spec/unit/provider/service/aix_service_spec.rb index a2557354c2..796661145b 100644 --- a/spec/unit/provider/service/aix_service_spec.rb +++ b/spec/unit/provider/service/aix_service_spec.rb @@ -55,7 +55,7 @@ describe Chef::Provider::Service::Aix do expect(@provider).to receive(:is_resource_group?).with(["chef chef 12345 active"]) @provider.load_current_resource - expect(@current_resource.running).to be_true + expect(@current_resource.running).to be_truthy end end @@ -69,7 +69,7 @@ describe Chef::Provider::Service::Aix do expect(@provider).to receive(:is_resource_group?).with(["chef chef inoperative"]) @provider.load_current_resource - expect(@current_resource.running).to be_false + expect(@current_resource.running).to be_falsey end end end @@ -83,7 +83,7 @@ describe Chef::Provider::Service::Aix do it "service is a group" do expect(@provider).to receive(:shell_out!).with("lssrc -a | grep -w chef").and_return(@status) @provider.load_current_resource - expect(@provider.instance_eval("@is_resource_group")).to be_true + expect(@provider.instance_eval("@is_resource_group")).to be_truthy end end @@ -95,7 +95,7 @@ describe Chef::Provider::Service::Aix do it "service is a group" do expect(@provider).to receive(:shell_out!).with("lssrc -a | grep -w chef").and_return(@status) @provider.load_current_resource - expect(@provider.instance_eval("@is_resource_group")).to be_true + expect(@provider.instance_eval("@is_resource_group")).to be_truthy end end @@ -107,7 +107,7 @@ describe Chef::Provider::Service::Aix do it "service is a subsystem" do expect(@provider).to receive(:shell_out!).with("lssrc -a | grep -w chef").and_return(@status) @provider.load_current_resource - expect(@provider.instance_eval("@is_resource_group")).to be_false + expect(@provider.instance_eval("@is_resource_group")).to be_falsey end end end diff --git a/spec/unit/provider/service/arch_service_spec.rb b/spec/unit/provider/service/arch_service_spec.rb index e71d9adfad..49be0e274c 100644 --- a/spec/unit/provider/service/arch_service_spec.rb +++ b/spec/unit/provider/service/arch_service_spec.rb @@ -62,19 +62,19 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do it "should set running to true if the status command returns 0" do allow(@provider).to receive(:shell_out).with("/etc/rc.d/chef status").and_return(OpenStruct.new(:exitstatus => 0)) @provider.load_current_resource - expect(@provider.current_resource.running).to be_true + expect(@provider.current_resource.running).to be_truthy end it "should set running to false if the status command returns anything except 0" do allow(@provider).to receive(:shell_out).with("/etc/rc.d/chef status").and_return(OpenStruct.new(:exitstatus => 1)) @provider.load_current_resource - expect(@provider.current_resource.running).to be_false + expect(@provider.current_resource.running).to be_falsey end it "should set running to false if the status command raises" do allow(@provider).to receive(:shell_out).with("/etc/rc.d/chef status").and_raise(Mixlib::ShellOut::ShellCommandFailed) @provider.load_current_resource - expect(@provider.current_resource.running).to be_false + expect(@provider.current_resource.running).to be_falsey end end @@ -135,13 +135,13 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS allow(@status).to receive(:stdout).and_return(@stdout) @provider.load_current_resource - expect(@provider.current_resource.running).to be_true + expect(@provider.current_resource.running).to be_truthy end it "determines the service is not running when it does not appear in ps" do allow(@provider).to receive(:shell_out!).and_return(@status) @provider.load_current_resource - expect(@provider.current_resource.running).to be_false + expect(@provider.current_resource.running).to be_falsey end it "should raise an exception if ps fails" do diff --git a/spec/unit/provider/service/debian_service_spec.rb b/spec/unit/provider/service/debian_service_spec.rb index b974a6bf9e..a4667e8ce8 100644 --- a/spec/unit/provider/service/debian_service_spec.rb +++ b/spec/unit/provider/service/debian_service_spec.rb @@ -67,13 +67,13 @@ describe Chef::Provider::Service::Debian do end it "says the service is enabled" do - expect(@provider.service_currently_enabled?(@provider.get_priority)).to be_true + expect(@provider.service_currently_enabled?(@provider.get_priority)).to be_truthy end it "stores the 'enabled' state" do allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource) expect(@provider.load_current_resource).to equal(@current_resource) - expect(@current_resource.enabled).to be_true + expect(@current_resource.enabled).to be_truthy end end @@ -90,13 +90,13 @@ describe Chef::Provider::Service::Debian do end it "says the service is disabled" do - expect(@provider.service_currently_enabled?(@provider.get_priority)).to be_false + expect(@provider.service_currently_enabled?(@provider.get_priority)).to be_falsey end it "stores the 'disabled' state" do allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource) expect(@provider.load_current_resource).to equal(@current_resource) - expect(@current_resource.enabled).to be_false + expect(@current_resource.enabled).to be_falsey end end @@ -206,13 +206,13 @@ insserv: dryrun, not creating .depend.boot, .depend.start, and .depend.stop end it "says the service is enabled" do - expect(@provider.service_currently_enabled?(@provider.get_priority)).to be_true + expect(@provider.service_currently_enabled?(@provider.get_priority)).to be_truthy end it "stores the 'enabled' state" do allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource) expect(@provider.load_current_resource).to equal(@current_resource) - expect(@current_resource.enabled).to be_true + expect(@current_resource.enabled).to be_truthy end it "stores the start/stop priorities of the service" do @@ -232,13 +232,13 @@ insserv: dryrun, not creating .depend.boot, .depend.start, and .depend.stop end it "says the service is disabled" do - expect(@provider.service_currently_enabled?(@provider.get_priority)).to be_false + expect(@provider.service_currently_enabled?(@provider.get_priority)).to be_falsey end it "stores the 'disabled' state" do allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource) expect(@provider.load_current_resource).to equal(@current_resource) - expect(@current_resource.enabled).to be_false + expect(@current_resource.enabled).to be_falsey end end end diff --git a/spec/unit/provider/service/freebsd_service_spec.rb b/spec/unit/provider/service/freebsd_service_spec.rb index eb55fac820..91d2d8e063 100644 --- a/spec/unit/provider/service/freebsd_service_spec.rb +++ b/spec/unit/provider/service/freebsd_service_spec.rb @@ -172,14 +172,14 @@ PS_SAMPLE it "should set running to true" do allow(provider).to receive(:shell_out!).and_return(status) provider.determine_current_status! - expect(current_resource.running).to be_true + expect(current_resource.running).to be_truthy end end it "should set running to false if the regex doesn't match" do allow(provider).to receive(:shell_out!).and_return(status) provider.determine_current_status! - expect(current_resource.running).to be_false + expect(current_resource.running).to be_falsey end it "should set running to nil if ps fails" do diff --git a/spec/unit/provider/service/gentoo_service_spec.rb b/spec/unit/provider/service/gentoo_service_spec.rb index 04734e9c5d..c08982acc3 100644 --- a/spec/unit/provider/service/gentoo_service_spec.rb +++ b/spec/unit/provider/service/gentoo_service_spec.rb @@ -48,13 +48,13 @@ describe Chef::Provider::Service::Gentoo do it "should track when service file is not found in /etc/runlevels" do @provider.load_current_resource - expect(@provider.instance_variable_get("@found_script")).to be_false + expect(@provider.instance_variable_get("@found_script")).to be_falsey end it "should track when service file is found in /etc/runlevels/**/" do allow(Dir).to receive(:glob).with("/etc/runlevels/**/chef").and_return(["/etc/runlevels/default/chef"]) @provider.load_current_resource - expect(@provider.instance_variable_get("@found_script")).to be_true + expect(@provider.instance_variable_get("@found_script")).to be_truthy end describe "when detecting the service enable state" do @@ -70,7 +70,7 @@ describe Chef::Provider::Service::Gentoo do end it "should set enabled to true" do @provider.load_current_resource - expect(@current_resource.enabled).to be_true + expect(@current_resource.enabled).to be_truthy end end @@ -82,7 +82,7 @@ describe Chef::Provider::Service::Gentoo do it "should set enabled to false" do @provider.load_current_resource - expect(@current_resource.enabled).to be_false + expect(@current_resource.enabled).to be_falsey end end @@ -94,7 +94,7 @@ describe Chef::Provider::Service::Gentoo do it "should set enabled to false" do @provider.load_current_resource - expect(@current_resource.enabled).to be_false + expect(@current_resource.enabled).to be_falsey end end @@ -108,17 +108,17 @@ describe Chef::Provider::Service::Gentoo do it "should support the status command automatically" do @provider.load_current_resource - expect(@new_resource.supports[:status]).to be_true + expect(@new_resource.supports[:status]).to be_truthy end it "should support the restart command automatically" do @provider.load_current_resource - expect(@new_resource.supports[:restart]).to be_true + expect(@new_resource.supports[:restart]).to be_truthy end it "should not support the reload command automatically" do @provider.load_current_resource - expect(@new_resource.supports[:reload]).not_to be_true + expect(@new_resource.supports[:reload]).not_to be_truthy end end diff --git a/spec/unit/provider/service/init_service_spec.rb b/spec/unit/provider/service/init_service_spec.rb index 5dc5256061..827a4261e1 100644 --- a/spec/unit/provider/service/init_service_spec.rb +++ b/spec/unit/provider/service/init_service_spec.rb @@ -64,20 +64,20 @@ PS it "should set running to true if the status command returns 0" do allow(@provider).to receive(:shell_out).with("/etc/init.d/#{@current_resource.service_name} status").and_return(@status) @provider.load_current_resource - expect(@current_resource.running).to be_true + expect(@current_resource.running).to be_truthy end it "should set running to false if the status command returns anything except 0" do allow(@status).to receive(:exitstatus).and_return(1) allow(@provider).to receive(:shell_out).with("/etc/init.d/#{@current_resource.service_name} status").and_return(@status) @provider.load_current_resource - expect(@current_resource.running).to be_false + expect(@current_resource.running).to be_falsey end it "should set running to false if the status command raises" do allow(@provider).to receive(:shell_out).and_raise(Mixlib::ShellOut::ShellCommandFailed) @provider.load_current_resource - expect(@current_resource.running).to be_false + expect(@current_resource.running).to be_falsey end end @@ -139,13 +139,13 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS allow(@status).to receive(:stdout).and_return(@stdout) @provider.load_current_resource - expect(@current_resource.running).to be_true + expect(@current_resource.running).to be_truthy end it "should set running to false if the regex doesn't match" do allow(@provider).to receive(:shell_out!).and_return(@status) @provider.load_current_resource - expect(@current_resource.running).to be_false + expect(@current_resource.running).to be_falsey end it "should raise an exception if ps fails" do diff --git a/spec/unit/provider/service/insserv_service_spec.rb b/spec/unit/provider/service/insserv_service_spec.rb index 6cead238fe..3799daebb4 100644 --- a/spec/unit/provider/service/insserv_service_spec.rb +++ b/spec/unit/provider/service/insserv_service_spec.rb @@ -41,7 +41,7 @@ describe Chef::Provider::Service::Insserv do it "sets the current enabled status to true" do @provider.load_current_resource - expect(@provider.current_resource.enabled).to be_true + expect(@provider.current_resource.enabled).to be_truthy end end @@ -52,7 +52,7 @@ describe Chef::Provider::Service::Insserv do it "sets the current enabled status to false" do @provider.load_current_resource - expect(@provider.current_resource.enabled).to be_false + expect(@provider.current_resource.enabled).to be_falsey end end diff --git a/spec/unit/provider/service/invokercd_service_spec.rb b/spec/unit/provider/service/invokercd_service_spec.rb index 0b3b799798..81588c80e5 100644 --- a/spec/unit/provider/service/invokercd_service_spec.rb +++ b/spec/unit/provider/service/invokercd_service_spec.rb @@ -64,20 +64,20 @@ PS it "should set running to true if the status command returns 0" do allow(@provider).to receive(:shell_out).with("/usr/sbin/invoke-rc.d #{@current_resource.service_name} status").and_return(@status) @provider.load_current_resource - expect(@current_resource.running).to be_true + expect(@current_resource.running).to be_truthy end it "should set running to false if the status command returns anything except 0" do allow(@status).to receive(:exitstatus).and_return(1) allow(@provider).to receive(:shell_out).with("/usr/sbin/invoke-rc.d #{@current_resource.service_name} status").and_return(@status) @provider.load_current_resource - expect(@current_resource.running).to be_false + expect(@current_resource.running).to be_falsey end it "should set running to false if the status command raises" do allow(@provider).to receive(:shell_out).with("/usr/sbin/invoke-rc.d #{@current_resource.service_name} status").and_raise(Mixlib::ShellOut::ShellCommandFailed) @provider.load_current_resource - expect(@current_resource.running).to be_false + expect(@current_resource.running).to be_falsey end end @@ -125,14 +125,14 @@ RUNNING_PS @status = double("Status", :exitstatus => 0, :stdout => @stdout) expect(@provider).to receive(:shell_out!).and_return(@status) @provider.load_current_resource - expect(@current_resource.running).to be_true + expect(@current_resource.running).to be_truthy end it "should set running to false if the regex doesn't match" do @status = double("Status", :exitstatus => 0, :stdout => @stdout) expect(@provider).to receive(:shell_out!).and_return(@status) @provider.load_current_resource - expect(@current_resource.running).to be_false + expect(@current_resource.running).to be_falsey end it "should raise an exception if ps fails" do diff --git a/spec/unit/provider/service/macosx_spec.rb b/spec/unit/provider/service/macosx_spec.rb index 0d31ae2ffb..fb751592df 100644 --- a/spec/unit/provider/service/macosx_spec.rb +++ b/spec/unit/provider/service/macosx_spec.rb @@ -130,11 +130,11 @@ XML end it "sets resource running state to true" do - expect(provider.current_resource.running).to be_true + expect(provider.current_resource.running).to be_truthy end it "sets resouce enabled state to true" do - expect(provider.current_resource.enabled).to be_true + expect(provider.current_resource.enabled).to be_truthy end end @@ -164,11 +164,11 @@ SVC_LIST end it "sets resource running state to false" do - expect(provider.current_resource.running).to be_false + expect(provider.current_resource.running).to be_falsey end it "sets resouce enabled state to true" do - expect(provider.current_resource.enabled).to be_true + expect(provider.current_resource.enabled).to be_truthy end end @@ -180,7 +180,7 @@ SVC_LIST it "sets service running state to false" do provider.load_current_resource - expect(provider.current_resource.running).to be_false + expect(provider.current_resource.running).to be_falsey end context "and plist for service is not available" do @@ -190,7 +190,7 @@ SVC_LIST end it "sets resouce enabled state to false" do - expect(provider.current_resource.enabled).to be_false + expect(provider.current_resource.enabled).to be_falsey end end @@ -201,7 +201,7 @@ SVC_LIST end it "sets resouce enabled state to true" do - expect(provider.current_resource.enabled).to be_true + expect(provider.current_resource.enabled).to be_truthy end end diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb index ed3dd5bfa7..73cfec8a6f 100644 --- a/spec/unit/provider/service/redhat_spec.rb +++ b/spec/unit/provider/service/redhat_spec.rb @@ -69,9 +69,9 @@ describe "Chef::Provider::Service::Redhat" do expect(@provider).to receive(:shell_out).with("/sbin/service chef status").and_return(status) chkconfig = double("Chkconfig", :exitstatus => 0, :stdout => "chef 0:off 1:off 2:off 3:off 4:off 5:on 6:off", :stderr => "") expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", :returns => [0,1]).and_return(chkconfig) - expect(@provider.instance_variable_get("@service_missing")).to be_false + expect(@provider.instance_variable_get("@service_missing")).to be_falsey @provider.load_current_resource - expect(@current_resource.enabled).to be_true + expect(@current_resource.enabled).to be_truthy end it "sets the current enabled status to false if the regex does not match" do @@ -79,9 +79,9 @@ describe "Chef::Provider::Service::Redhat" do expect(@provider).to receive(:shell_out).with("/sbin/service chef status").and_return(status) chkconfig = double("Chkconfig", :exitstatus => 0, :stdout => "chef 0:off 1:off 2:off 3:off 4:off 5:off 6:off", :stderr => "") expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", :returns => [0,1]).and_return(chkconfig) - expect(@provider.instance_variable_get("@service_missing")).to be_false + expect(@provider.instance_variable_get("@service_missing")).to be_falsey expect(@provider.load_current_resource).to eql(@current_resource) - expect(@current_resource.enabled).to be_false + expect(@current_resource.enabled).to be_falsey end end diff --git a/spec/unit/provider/service/simple_service_spec.rb b/spec/unit/provider/service/simple_service_spec.rb index 83ebcb688f..895c559dff 100644 --- a/spec/unit/provider/service/simple_service_spec.rb +++ b/spec/unit/provider/service/simple_service_spec.rb @@ -82,13 +82,13 @@ NOMOCKINGSTRINGSPLZ @status = double("Status", :exitstatus => 0, :stdout => @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) @provider.load_current_resource - expect(@current_resource.running).to be_true + expect(@current_resource.running).to be_truthy end it "should set running to false if the regex doesn't match" do allow(@provider).to receive(:shell_out!).and_return(@status) @provider.load_current_resource - expect(@current_resource.running).to be_false + expect(@current_resource.running).to be_falsey end it "should raise an exception if ps fails" do diff --git a/spec/unit/provider/service/solaris_smf_service_spec.rb b/spec/unit/provider/service/solaris_smf_service_spec.rb index 2f790a0ebb..2039408914 100644 --- a/spec/unit/provider/service/solaris_smf_service_spec.rb +++ b/spec/unit/provider/service/solaris_smf_service_spec.rb @@ -85,14 +85,14 @@ describe Chef::Provider::Service::Solaris do it "should not mark service as maintenance" do allow(@provider).to receive(:shell_out!).and_return(@status) @provider.load_current_resource - expect(@provider.maintenance).to be_false + expect(@provider.maintenance).to be_falsey end it "should mark service as maintenance" do @status = double("Status", :exitstatus => 0, :stdout => 'state maintenance') allow(@provider).to receive(:shell_out!).and_return(@status) @provider.load_current_resource - expect(@provider.maintenance).to be_true + expect(@provider.maintenance).to be_truthy end end @@ -105,15 +105,15 @@ describe Chef::Provider::Service::Solaris do it "should call svcadm enable -s chef" do expect(@provider).not_to receive(:shell_out!).with("/usr/sbin/svcadm clear #{@current_resource.service_name}") expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm enable -s #{@current_resource.service_name}").and_return(@status) - expect(@provider.enable_service).to be_true - expect(@current_resource.enabled).to be_true + expect(@provider.enable_service).to be_truthy + expect(@current_resource.enabled).to be_truthy end it "should call svcadm enable -s chef for start_service" do expect(@provider).not_to receive(:shell_out!).with("/usr/sbin/svcadm clear #{@current_resource.service_name}") expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm enable -s #{@current_resource.service_name}").and_return(@status) - expect(@provider.start_service).to be_true - expect(@current_resource.enabled).to be_true + expect(@provider.start_service).to be_truthy + expect(@current_resource.enabled).to be_truthy end it "should call svcadm clear chef for start_service when state maintenance" do @@ -122,8 +122,8 @@ describe Chef::Provider::Service::Solaris do @provider.load_current_resource expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm clear #{@current_resource.service_name}").and_return(@status) expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm enable -s #{@current_resource.service_name}").and_return(@status) - expect(@provider.enable_service).to be_true - expect(@current_resource.enabled).to be_true + expect(@provider.enable_service).to be_truthy + expect(@current_resource.enabled).to be_truthy end end @@ -135,14 +135,14 @@ describe Chef::Provider::Service::Solaris do it "should call svcadm disable -s chef" do expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm disable -s chef").and_return(@status) - expect(@provider.disable_service).to be_true - expect(@current_resource.enabled).to be_false + expect(@provider.disable_service).to be_truthy + expect(@current_resource.enabled).to be_falsey end it "should call svcadm disable -s chef for stop_service" do expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm disable -s chef").and_return(@status) - expect(@provider.stop_service).to be_true - expect(@current_resource.enabled).to be_false + expect(@provider.stop_service).to be_truthy + expect(@current_resource.enabled).to be_falsey end end @@ -170,13 +170,13 @@ describe Chef::Provider::Service::Solaris do it "should be marked not running" do expect(@provider).to receive(:shell_out!).with("/bin/svcs -l chef", {:returns=>[0, 1]}).and_return(@status) @provider.service_status - expect(@current_resource.running).to be_false + expect(@current_resource.running).to be_falsey end it "should be marked not enabled" do expect(@provider).to receive(:shell_out!).with("/bin/svcs -l chef", {:returns=>[0, 1]}).and_return(@status) @provider.service_status - expect(@current_resource.enabled).to be_false + expect(@current_resource.enabled).to be_falsey end end diff --git a/spec/unit/provider/service/systemd_service_spec.rb b/spec/unit/provider/service/systemd_service_spec.rb index 2fed6bfd11..2bdbdaad05 100644 --- a/spec/unit/provider/service/systemd_service_spec.rb +++ b/spec/unit/provider/service/systemd_service_spec.rb @@ -82,7 +82,7 @@ describe Chef::Provider::Service::Systemd do it "should run the services status command if one has been specified and properly set status check state" do allow(@provider).to receive(:shell_out).with("/bin/chefhasmonkeypants status").and_return(@shell_out_success) @provider.load_current_resource - expect(@provider.instance_variable_get("@status_check_success")).to be_true + expect(@provider.instance_variable_get("@status_check_success")).to be_truthy end it "should set running to false if a status command fails" do @@ -94,7 +94,7 @@ describe Chef::Provider::Service::Systemd do it "should update state to indicate status check failed when a status command fails" do allow(@provider).to receive(:shell_out).and_return(@shell_out_failure) @provider.load_current_resource - expect(@provider.instance_variable_get("@status_check_success")).to be_false + expect(@provider.instance_variable_get("@status_check_success")).to be_falsey end end @@ -228,12 +228,12 @@ describe Chef::Provider::Service::Systemd do it "should return true if '/bin/systemctl is-active service_name' returns 0" do expect(@provider).to receive(:shell_out).with('/bin/systemctl is-active rsyslog.service --quiet').and_return(@shell_out_success) - expect(@provider.is_active?).to be_true + expect(@provider.is_active?).to be_truthy end it "should return false if '/bin/systemctl is-active service_name' returns anything except 0" do expect(@provider).to receive(:shell_out).with('/bin/systemctl is-active rsyslog.service --quiet').and_return(@shell_out_failure) - expect(@provider.is_active?).to be_false + expect(@provider.is_active?).to be_falsey end end @@ -245,12 +245,12 @@ describe Chef::Provider::Service::Systemd do it "should return true if '/bin/systemctl is-enabled service_name' returns 0" do expect(@provider).to receive(:shell_out).with('/bin/systemctl is-enabled rsyslog.service --quiet').and_return(@shell_out_success) - expect(@provider.is_enabled?).to be_true + expect(@provider.is_enabled?).to be_truthy end it "should return false if '/bin/systemctl is-enabled service_name' returns anything except 0" do expect(@provider).to receive(:shell_out).with('/bin/systemctl is-enabled rsyslog.service --quiet').and_return(@shell_out_failure) - expect(@provider.is_enabled?).to be_false + expect(@provider.is_enabled?).to be_falsey end end end diff --git a/spec/unit/provider/service/upstart_service_spec.rb b/spec/unit/provider/service/upstart_service_spec.rb index 69948fbc6a..ca7ce8f930 100644 --- a/spec/unit/provider/service/upstart_service_spec.rb +++ b/spec/unit/provider/service/upstart_service_spec.rb @@ -108,14 +108,14 @@ describe Chef::Provider::Service::Upstart do @stdout = StringIO.new("rsyslog start/running") allow(@provider).to receive(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) @provider.load_current_resource - expect(@current_resource.running).to be_true + expect(@current_resource.running).to be_truthy end it "should set running to false if the status command returns anything except 0" do @stdout = StringIO.new("rsyslog stop/waiting") allow(@provider).to receive(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) @provider.load_current_resource - expect(@current_resource.running).to be_false + expect(@current_resource.running).to be_falsey end end @@ -124,14 +124,14 @@ describe Chef::Provider::Service::Upstart do @stdout = StringIO.new("rsyslog (start) running, process 32225") allow(@provider).to receive(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) @provider.load_current_resource - expect(@current_resource.running).to be_true + expect(@current_resource.running).to be_truthy end it "should set running to false if the status command returns anything except 0" do @stdout = StringIO.new("rsyslog (stop) waiting") allow(@provider).to receive(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) @provider.load_current_resource - expect(@current_resource.running).to be_false + expect(@current_resource.running).to be_falsey end end diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb index f35f169bc4..e4b0714d22 100644 --- a/spec/unit/provider/service/windows_spec.rb +++ b/spec/unit/provider/service/windows_spec.rb @@ -51,12 +51,12 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do it "should set the current resources status" do @provider.load_current_resource - expect(@provider.current_resource.running).to be_true + expect(@provider.current_resource.running).to be_truthy end it "should set the current resources start type" do @provider.load_current_resource - expect(@provider.current_resource.enabled).to be_true + expect(@provider.current_resource.enabled).to be_truthy end it "does not set the current resources start type if it is neither AUTO START or DISABLED" do @@ -77,20 +77,20 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @new_resource.start_command "sc start chef" expect(@provider).to receive(:shell_out!).with("#{@new_resource.start_command}").and_return("Starting custom service") @provider.start_service - expect(@new_resource.updated_by_last_action?).to be_true + expect(@new_resource.updated_by_last_action?).to be_truthy end it "should use the built-in command if no start command is specified" do expect(Win32::Service).to receive(:start).with(@new_resource.service_name) @provider.start_service - expect(@new_resource.updated_by_last_action?).to be_true + expect(@new_resource.updated_by_last_action?).to be_truthy end it "should do nothing if the service does not exist" do allow(Win32::Service).to receive(:exists?).with(@new_resource.service_name).and_return(false) expect(Win32::Service).not_to receive(:start).with(@new_resource.service_name) @provider.start_service - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end it "should do nothing if the service is running" do @@ -99,7 +99,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @provider.load_current_resource expect(Win32::Service).not_to receive(:start).with(@new_resource.service_name) @provider.start_service - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end it "should raise an error if the service is paused" do @@ -108,7 +108,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @provider.load_current_resource expect(Win32::Service).not_to receive(:start).with(@new_resource.service_name) expect { @provider.start_service }.to raise_error( Chef::Exceptions::Service ) - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end it "should wait and continue if the service is in start_pending" do @@ -119,7 +119,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @provider.load_current_resource expect(Win32::Service).not_to receive(:start).with(@new_resource.service_name) @provider.start_service - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end it "should fail if the service is in stop_pending" do @@ -128,7 +128,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @provider.load_current_resource expect(Win32::Service).not_to receive(:start).with(@new_resource.service_name) expect { @provider.start_service }.to raise_error( Chef::Exceptions::Service ) - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end end @@ -146,20 +146,20 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @new_resource.stop_command "sc stop chef" expect(@provider).to receive(:shell_out!).with("#{@new_resource.stop_command}").and_return("Stopping custom service") @provider.stop_service - expect(@new_resource.updated_by_last_action?).to be_true + expect(@new_resource.updated_by_last_action?).to be_truthy end it "should use the built-in command if no stop command is specified" do expect(Win32::Service).to receive(:stop).with(@new_resource.service_name) @provider.stop_service - expect(@new_resource.updated_by_last_action?).to be_true + expect(@new_resource.updated_by_last_action?).to be_truthy end it "should do nothing if the service does not exist" do allow(Win32::Service).to receive(:exists?).with(@new_resource.service_name).and_return(false) expect(Win32::Service).not_to receive(:stop).with(@new_resource.service_name) @provider.stop_service - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end it "should do nothing if the service is stopped" do @@ -168,7 +168,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @provider.load_current_resource expect(Win32::Service).not_to receive(:stop).with(@new_resource.service_name) @provider.stop_service - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end it "should raise an error if the service is paused" do @@ -177,7 +177,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @provider.load_current_resource expect(Win32::Service).not_to receive(:start).with(@new_resource.service_name) expect { @provider.stop_service }.to raise_error( Chef::Exceptions::Service ) - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end it "should wait and continue if the service is in stop_pending" do @@ -188,7 +188,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @provider.load_current_resource expect(Win32::Service).not_to receive(:stop).with(@new_resource.service_name) @provider.stop_service - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end it "should fail if the service is in start_pending" do @@ -197,7 +197,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @provider.load_current_resource expect(Win32::Service).not_to receive(:stop).with(@new_resource.service_name) expect { @provider.stop_service }.to raise_error( Chef::Exceptions::Service ) - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end it "should pass custom timeout to the stop command if provided" do @@ -208,7 +208,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do Timeout.timeout(2) do expect { @provider.stop_service }.to raise_error(Timeout::Error) end - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end end @@ -219,7 +219,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @new_resource.restart_command "sc restart" expect(@provider).to receive(:shell_out!).with("#{@new_resource.restart_command}") @provider.restart_service - expect(@new_resource.updated_by_last_action?).to be_true + expect(@new_resource.updated_by_last_action?).to be_truthy end it "should stop then start the service if it is running" do @@ -231,7 +231,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do expect(Win32::Service).to receive(:stop).with(@new_resource.service_name) expect(Win32::Service).to receive(:start).with(@new_resource.service_name) @provider.restart_service - expect(@new_resource.updated_by_last_action?).to be_true + expect(@new_resource.updated_by_last_action?).to be_truthy end it "should just start the service if it is stopped" do @@ -241,7 +241,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do double("StatusStruct", :current_state => "running")) expect(Win32::Service).to receive(:start).with(@new_resource.service_name) @provider.restart_service - expect(@new_resource.updated_by_last_action?).to be_true + expect(@new_resource.updated_by_last_action?).to be_truthy end it "should do nothing if the service does not exist" do @@ -249,7 +249,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do expect(Win32::Service).not_to receive(:stop).with(@new_resource.service_name) expect(Win32::Service).not_to receive(:start).with(@new_resource.service_name) @provider.restart_service - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end end @@ -263,14 +263,14 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do it "should enable service" do expect(Win32::Service).to receive(:configure).with(:service_name => @new_resource.service_name, :start_type => Win32::Service::AUTO_START) @provider.enable_service - expect(@new_resource.updated_by_last_action?).to be_true + expect(@new_resource.updated_by_last_action?).to be_truthy end it "should do nothing if the service does not exist" do allow(Win32::Service).to receive(:exists?).with(@new_resource.service_name).and_return(false) expect(Win32::Service).not_to receive(:configure) @provider.enable_service - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end end @@ -315,14 +315,14 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do it "should disable service" do expect(Win32::Service).to receive(:configure) @provider.disable_service - expect(@new_resource.updated_by_last_action?).to be_true + expect(@new_resource.updated_by_last_action?).to be_truthy end it "should do nothing if the service does not exist" do allow(Win32::Service).to receive(:exists?).with(@new_resource.service_name).and_return(false) expect(Win32::Service).not_to receive(:configure) @provider.disable_service - expect(@new_resource.updated_by_last_action?).to be_false + expect(@new_resource.updated_by_last_action?).to be_falsey end end diff --git a/spec/unit/provider/service_spec.rb b/spec/unit/provider/service_spec.rb index e60b08e7f0..17bade55b6 100644 --- a/spec/unit/provider/service_spec.rb +++ b/spec/unit/provider/service_spec.rb @@ -69,7 +69,7 @@ describe Chef::Provider::Service do describe "action_start" do it "should start the service if it isn't running and set the resource as updated" do @current_resource.running(false) - expect(@provider).to receive(:start_service).with.and_return(true) + expect(@provider).to receive(:start_service).with(no_args).and_return(true) @provider.run_action(:start) expect(@provider.new_resource).to be_updated end diff --git a/spec/unit/provider/user/dscl_spec.rb b/spec/unit/provider/user/dscl_spec.rb index c8dbef770e..24691cce33 100644 --- a/spec/unit/provider/user/dscl_spec.rb +++ b/spec/unit/provider/user/dscl_spec.rb @@ -171,7 +171,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30" describe "uid_used?" do it "should return false if not given any valid uid number" do - expect(provider.uid_used?(nil)).to be_false + expect(provider.uid_used?(nil)).to be_falsey end describe "when called with a user id" do @@ -180,11 +180,11 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30" end it "should return true for a used uid number" do - expect(provider.uid_used?(500)).to be_true + expect(provider.uid_used?(500)).to be_truthy end it "should return false for an unused uid number" do - expect(provider.uid_used?(501)).to be_false + expect(provider.uid_used?(501)).to be_falsey end end end @@ -400,7 +400,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30" it "should set @user_exists" do provider.load_current_resource - expect(provider.instance_variable_get(:@user_exists)).to be_false + expect(provider.instance_variable_get(:@user_exists)).to be_falsey end it "should set username" do @@ -434,7 +434,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30" it "diverged_password? should report false" do provider.load_current_resource - expect(provider.diverged_password?).to be_false + expect(provider.diverged_password?).to be_falsey end end @@ -443,7 +443,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30" it "diverged_password? should report true" do provider.load_current_resource - expect(provider.diverged_password?).to be_true + expect(provider.diverged_password?).to be_truthy end end @@ -453,7 +453,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30" it "diverged_password? should report false" do provider.load_current_resource - expect(provider.diverged_password?).to be_false + expect(provider.diverged_password?).to be_falsey end end @@ -462,7 +462,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30" it "diverged_password? should report true" do provider.load_current_resource - expect(provider.diverged_password?).to be_true + expect(provider.diverged_password?).to be_truthy end end @@ -472,7 +472,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30" it "diverged_password? should report false" do provider.load_current_resource - expect(provider.diverged_password?).to be_false + expect(provider.diverged_password?).to be_falsey end end end @@ -525,7 +525,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30") describe "when a plain text password is set" do it "reports password needs to be updated" do provider.load_current_resource - expect(provider.diverged_password?).to be_true + expect(provider.diverged_password?).to be_truthy end end @@ -536,7 +536,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30") it "reports password needs to be updated" do provider.load_current_resource - expect(provider.diverged_password?).to be_true + expect(provider.diverged_password?).to be_truthy end end end @@ -565,7 +565,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30") it "diverged_password? should report false" do provider.load_current_resource - expect(provider.diverged_password?).to be_false + expect(provider.diverged_password?).to be_falsey end end @@ -574,7 +574,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30") it "diverged_password? should report true" do provider.load_current_resource - expect(provider.diverged_password?).to be_true + expect(provider.diverged_password?).to be_truthy end end @@ -585,7 +585,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30") it "diverged_password? should report true" do provider.load_current_resource - expect(provider.diverged_password?).to be_true + expect(provider.diverged_password?).to be_truthy end end @@ -596,7 +596,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30") it "diverged_password? should report true" do provider.load_current_resource - expect(provider.diverged_password?).to be_true + expect(provider.diverged_password?).to be_truthy end end @@ -607,7 +607,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30") it "diverged_password? should report true" do provider.load_current_resource - expect(provider.diverged_password?).to be_true + expect(provider.diverged_password?).to be_truthy end end end @@ -616,23 +616,23 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30") describe "salted_sha512_pbkdf2?" do it "should return true when the string is a salted_sha512_pbkdf2 hash" do - expect(provider.salted_sha512_pbkdf2?(salted_sha512_pbkdf2_password)).to be_true + expect(provider.salted_sha512_pbkdf2?(salted_sha512_pbkdf2_password)).to be_truthy end it "should return false otherwise" do - expect(provider.salted_sha512_pbkdf2?(salted_sha512_password)).to be_false - expect(provider.salted_sha512_pbkdf2?("any other string")).to be_false + expect(provider.salted_sha512_pbkdf2?(salted_sha512_password)).to be_falsey + expect(provider.salted_sha512_pbkdf2?("any other string")).to be_falsey end end describe "salted_sha512?" do it "should return true when the string is a salted_sha512_pbkdf2 hash" do - expect(provider.salted_sha512_pbkdf2?(salted_sha512_pbkdf2_password)).to be_true + expect(provider.salted_sha512_pbkdf2?(salted_sha512_pbkdf2_password)).to be_truthy end it "should return false otherwise" do - expect(provider.salted_sha512?(salted_sha512_pbkdf2_password)).to be_false - expect(provider.salted_sha512?("any other string")).to be_false + expect(provider.salted_sha512?(salted_sha512_pbkdf2_password)).to be_falsey + expect(provider.salted_sha512?("any other string")).to be_falsey end end @@ -649,7 +649,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30") shadow_info = provider.prepare_password_shadow_info expect(shadow_info).to have_key("SALTED-SHA512") info = shadow_info["SALTED-SHA512"].string.unpack('H*').first - expect(provider.salted_sha512?(info)).to be_true + expect(provider.salted_sha512?(info)).to be_truthy end end @@ -660,7 +660,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30") shadow_info = provider.prepare_password_shadow_info expect(shadow_info).to have_key("SALTED-SHA512") info = shadow_info["SALTED-SHA512"].string.unpack('H*').first - expect(provider.salted_sha512?(info)).to be_true + expect(provider.salted_sha512?(info)).to be_truthy expect(info).to eq(vagrant_sha_512) end end @@ -682,7 +682,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30") expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("salt") expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("iterations") info = shadow_info["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack('H*').first - expect(provider.salted_sha512_pbkdf2?(info)).to be_true + expect(provider.salted_sha512_pbkdf2?(info)).to be_truthy end end @@ -698,7 +698,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30") expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("salt") expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("iterations") info = shadow_info["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack('H*').first - expect(provider.salted_sha512_pbkdf2?(info)).to be_true + expect(provider.salted_sha512_pbkdf2?(info)).to be_truthy expect(info).to eq(vagrant_sha_512_pbkdf2) end end |