diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-08-12 09:10:30 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-08-12 14:01:48 -0700 |
commit | a62719b1ab6ea90a6c308daaca11e9b253cc69fb (patch) | |
tree | 53889460de81c80ccc5ee324efc4444aea3817dc | |
parent | 798cac61accc035b51aaac25160bf1d5e9715252 (diff) | |
download | chef-a62719b1ab6ea90a6c308daaca11e9b253cc69fb.tar.gz |
Minor tweaks to the platform checks in the specsminor_spec
Use match? to make sure we always get a bool back. Rename os_x? to
macos?
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | spec/functional/resource/link_spec.rb | 4 | ||||
-rw-r--r-- | spec/support/platform_helpers.rb | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb index fc260845e4..22bc6e6121 100644 --- a/spec/functional/resource/link_spec.rb +++ b/spec/functional/resource/link_spec.rb @@ -403,7 +403,7 @@ describe Chef::Resource::Link do it "create errors out" do if windows? expect { resource.run_action(:create) }.to raise_error(Errno::EACCES) - elsif os_x? || solaris? || freebsd? || aix? + elsif macos? || solaris? || freebsd? || aix? expect { resource.run_action(:create) }.to raise_error(Errno::EPERM) else expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR) @@ -606,7 +606,7 @@ describe Chef::Resource::Link do it "errors out" do if windows? expect { resource.run_action(:create) }.to raise_error(Errno::EACCES) - elsif os_x? || solaris? || freebsd? || aix? + elsif macos? || solaris? || freebsd? || aix? expect { resource.run_action(:create) }.to raise_error(Errno::EPERM) else expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR) diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb index 7e17b75206..05839d40ea 100644 --- a/spec/support/platform_helpers.rb +++ b/spec/support/platform_helpers.rb @@ -134,19 +134,19 @@ def unix? end def linux? - !!(RUBY_PLATFORM =~ /linux/) + RUBY_PLATFORM.match?(/linux/) end -def os_x? - !!(RUBY_PLATFORM =~ /darwin/) +def macos? + RUBY_PLATFORM.match?(/darwin/) end def solaris? - !!(RUBY_PLATFORM =~ /solaris/) + RUBY_PLATFORM.match?(/solaris/) end def freebsd? - !!(RUBY_PLATFORM =~ /freebsd/) + RUBY_PLATFORM.match?(/freebsd/) end def intel_64bit? @@ -182,7 +182,7 @@ def debian_family? end def aix? - !!(RUBY_PLATFORM =~ /aix/) + RUBY_PLATFORM.match?(/aix/) end def wpar? |