diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-03-14 10:34:33 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-03-14 10:34:33 -0700 |
commit | 6705acbd7f301d1b04388043a3dfa0308655f120 (patch) | |
tree | 1e8a43b35ef1684a4b90578f1a6374758aa7e3c7 /spec | |
parent | 365064280c93d519fdacbf032c0c21057e5549c9 (diff) | |
download | chef-6705acbd7f301d1b04388043a3dfa0308655f120.tar.gz |
chefstyle Style/AndOr fixes
this is part of our informal style guide, lets make it formal since
clearly its not getting followed very well.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/event_loggers/windows_eventlog_spec.rb | 2 | ||||
-rw-r--r-- | spec/functional/resource/link_spec.rb | 8 | ||||
-rw-r--r-- | spec/spec_helper.rb | 2 | ||||
-rw-r--r-- | spec/support/lib/chef/resource/cat.rb | 2 | ||||
-rw-r--r-- | spec/support/lib/chef/resource/one_two_three_four.rb | 2 | ||||
-rw-r--r-- | spec/support/shared/matchers/exit_with_code.rb | 2 | ||||
-rw-r--r-- | spec/unit/knife/bootstrap_spec.rb | 6 | ||||
-rw-r--r-- | spec/unit/knife/environment_compare_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/mixin/shell_out_spec.rb | 2 |
9 files changed, 14 insertions, 14 deletions
diff --git a/spec/functional/event_loggers/windows_eventlog_spec.rb b/spec/functional/event_loggers/windows_eventlog_spec.rb index 69874ef677..78aed7409f 100644 --- a/spec/functional/event_loggers/windows_eventlog_spec.rb +++ b/spec/functional/event_loggers/windows_eventlog_spec.rb @@ -19,7 +19,7 @@ require "spec_helper" require "securerandom" require "chef/event_loggers/windows_eventlog" -if Chef::Platform.windows? and not Chef::Platform.windows_server_2003? +if Chef::Platform.windows? && (not Chef::Platform.windows_server_2003?) require "win32/eventlog" include Win32 end diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb index 7ea3b44a3d..6dd6ad8422 100644 --- a/spec/functional/resource/link_spec.rb +++ b/spec/functional/resource/link_spec.rb @@ -343,7 +343,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? or solaris? or freebsd? or aix? + elsif os_x? || solaris? || freebsd? || aix? expect { resource.run_action(:create) }.to raise_error(Errno::EPERM) else expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR) @@ -512,7 +512,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? or solaris? or freebsd? or aix? + elsif os_x? || solaris? || freebsd? || aix? expect { resource.run_action(:create) }.to raise_error(Errno::EPERM) else expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR) @@ -559,7 +559,7 @@ describe Chef::Resource::Link do end context "and the link does not yet exist" do it "links to the target file" do - skip("OS X/FreeBSD/AIX symlink? and readlink working on hard links to symlinks") if os_x? or freebsd? or aix? + skip("OS X/FreeBSD/AIX symlink? and readlink working on hard links to symlinks") if os_x? || freebsd? || aix? resource.run_action(:create) expect(File.exists?(target_file)).to be_truthy # OS X gets angry about this sort of link. Bug in OS X, IMO. @@ -578,7 +578,7 @@ describe Chef::Resource::Link do end context "and the link does not yet exist" do it "links to the target file" do - skip("OS X/FreeBSD/AIX fails to create hardlinks to broken symlinks") if os_x? or freebsd? or aix? + skip("OS X/FreeBSD/AIX fails to create hardlinks to broken symlinks") if os_x? || freebsd? || aix? resource.run_action(:create) # Windows and Unix have different definitions of exists? here, and that's OK. if windows? diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7d64f1afcd..2f6747c9af 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -117,7 +117,7 @@ RSpec.configure do |config| end # Only run these tests on platforms that are also chef workstations - config.filter_run_excluding :workstation if solaris? or aix? + config.filter_run_excluding :workstation if solaris? || aix? # Tests that randomly fail, but may have value. config.filter_run_excluding :volatile => true diff --git a/spec/support/lib/chef/resource/cat.rb b/spec/support/lib/chef/resource/cat.rb index 94190e1f5b..f62db4d2cd 100644 --- a/spec/support/lib/chef/resource/cat.rb +++ b/spec/support/lib/chef/resource/cat.rb @@ -28,7 +28,7 @@ class Chef end def pretty_kitty(arg = nil) - if arg == true or arg == false + if arg == true || arg == false @pretty_kitty = arg end @pretty_kitty diff --git a/spec/support/lib/chef/resource/one_two_three_four.rb b/spec/support/lib/chef/resource/one_two_three_four.rb index d46d20d2b5..e46bede0fa 100644 --- a/spec/support/lib/chef/resource/one_two_three_four.rb +++ b/spec/support/lib/chef/resource/one_two_three_four.rb @@ -27,7 +27,7 @@ class Chef end def something(arg = nil) - if arg == true or arg == false + if arg == true || arg == false @something = arg end @something diff --git a/spec/support/shared/matchers/exit_with_code.rb b/spec/support/shared/matchers/exit_with_code.rb index c5458eea0e..a9f1af81ce 100644 --- a/spec/support/shared/matchers/exit_with_code.rb +++ b/spec/support/shared/matchers/exit_with_code.rb @@ -9,7 +9,7 @@ RSpec::Matchers.define :exit_with_code do |exp_code| rescue SystemExit => e actual = e.status end - actual and actual == exp_code + actual && actual == exp_code end failure_message do |block| diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb index 8ad5c338c3..1508e6e3a7 100644 --- a/spec/unit/knife/bootstrap_spec.rb +++ b/spec/unit/knife/bootstrap_spec.rb @@ -621,9 +621,9 @@ describe Chef::Knife::Bootstrap do end it "use_sudo_password contains description and long params for help" do - expect(knife.options).to have_key(:use_sudo_password) \ - and expect(knife.options[:use_sudo_password][:description].to_s).not_to eq("")\ - and expect(knife.options[:use_sudo_password][:long].to_s).not_to eq("") + expect(knife.options).to(have_key(:use_sudo_password)) \ + && expect(knife.options[:use_sudo_password][:description].to_s).not_to(eq(""))\ + && expect(knife.options[:use_sudo_password][:long].to_s).not_to(eq("")) end it "uses the password from --ssh-password for sudo when --use-sudo-password is set" do diff --git a/spec/unit/knife/environment_compare_spec.rb b/spec/unit/knife/environment_compare_spec.rb index 863cdd4e6e..e408532884 100644 --- a/spec/unit/knife/environment_compare_spec.rb +++ b/spec/unit/knife/environment_compare_spec.rb @@ -62,7 +62,7 @@ describe Chef::Knife::EnvironmentCompare do @knife.config[:format] = "summary" @knife.run @environments.each do |item, url| - expect(@stdout.string).to match /#{item}/ and expect(@stdout.string.lines.count).to be 4 + expect(@stdout.string).to(match /#{item}/) && expect(@stdout.string.lines.count).to(be 4) end end diff --git a/spec/unit/mixin/shell_out_spec.rb b/spec/unit/mixin/shell_out_spec.rb index e9fabfd0a7..2dedd7d364 100644 --- a/spec/unit/mixin/shell_out_spec.rb +++ b/spec/unit/mixin/shell_out_spec.rb @@ -53,7 +53,7 @@ describe Chef::Mixin::ShellOut do def self.should_emit_deprecation_warning_about(old_option, new_option) it "should emit a deprecation warning" do - assume_deprecation_log_level and capture_log_output + assume_deprecation_log_level && capture_log_output subject expect(output.string).to match /DEPRECATION:/ expect(output.string).to match Regexp.escape(old_option.to_s) |