diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-01-12 09:56:40 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-01-12 09:56:40 -0800 |
commit | 6610ebd39d19c3b8776d69a56a39c3b496b8b29f (patch) | |
tree | a5c282b16f71e3f8be0f3ed99310c82cc41ecd6d /spec | |
parent | 812101f11a6c33e49f401ad72598ca6ffb38adc4 (diff) | |
download | chef-6610ebd39d19c3b8776d69a56a39c3b496b8b29f.tar.gz |
really fix copslcg/really-fix-cops
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/application_spec.rb | 8 | ||||
-rw-r--r-- | spec/functional/mixin/shell_out_spec.rb | 16 | ||||
-rw-r--r-- | spec/functional/resource/file_spec.rb | 12 | ||||
-rw-r--r-- | spec/support/shared/context/win32.rb | 12 | ||||
-rw-r--r-- | spec/unit/application/knife_spec.rb | 10 | ||||
-rw-r--r-- | spec/unit/knife/cookbook_site_install_spec.rb | 14 | ||||
-rw-r--r-- | spec/unit/provider/package/rubygems_spec.rb | 16 |
7 files changed, 45 insertions, 43 deletions
diff --git a/spec/functional/application_spec.rb b/spec/functional/application_spec.rb index fe656dca60..4d24549696 100644 --- a/spec/functional/application_spec.rb +++ b/spec/functional/application_spec.rb @@ -47,10 +47,10 @@ describe Chef::Application do it "saves built proxy to ENV which shell_out can use" do so = if windows? - shell_out("echo %http_proxy%") - else - shell_out("echo $http_proxy") - end + shell_out("echo %http_proxy%") + else + shell_out("echo $http_proxy") + end expect(so.stdout.chomp).to eq("http://proxy.example.org:8080") end diff --git a/spec/functional/mixin/shell_out_spec.rb b/spec/functional/mixin/shell_out_spec.rb index 35e5b30eae..8f8b54414a 100644 --- a/spec/functional/mixin/shell_out_spec.rb +++ b/spec/functional/mixin/shell_out_spec.rb @@ -24,10 +24,10 @@ describe Chef::Mixin::ShellOut do describe "when environment['LC_ALL'] is not set" do it "should use the default shell_out setting" do cmd = if windows? - shell_out_with_systems_locale('echo %LC_ALL%') - else - shell_out_with_systems_locale('echo $LC_ALL') - end + shell_out_with_systems_locale('echo %LC_ALL%') + else + shell_out_with_systems_locale('echo $LC_ALL') + end expect(cmd.stdout.chomp).to match_environment_variable('LC_ALL') end @@ -36,10 +36,10 @@ describe Chef::Mixin::ShellOut do describe "when environment['LC_ALL'] is set" do it "should use the option's setting" do cmd = if windows? - shell_out_with_systems_locale('echo %LC_ALL%', :environment => {'LC_ALL' => 'POSIX'}) - else - shell_out_with_systems_locale('echo $LC_ALL', :environment => {'LC_ALL' => 'POSIX'}) - end + shell_out_with_systems_locale('echo %LC_ALL%', :environment => {'LC_ALL' => 'POSIX'}) + else + shell_out_with_systems_locale('echo $LC_ALL', :environment => {'LC_ALL' => 'POSIX'}) + end expect(cmd.stdout.chomp).to eq 'POSIX' end diff --git a/spec/functional/resource/file_spec.rb b/spec/functional/resource/file_spec.rb index 9e30e62111..861bc65363 100644 --- a/spec/functional/resource/file_spec.rb +++ b/spec/functional/resource/file_spec.rb @@ -1,6 +1,6 @@ # # Author:: Seth Chisamore (<schisamo@opscode.com>) -# Copyright:: Copyright (c) 2011 Opscode, Inc. +# Copyright:: Copyright (c) 2011-2016 Chef Software, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,11 +31,11 @@ describe Chef::Resource::File do run_context = Chef::RunContext.new(node, {}, events) use_path = if opts[:use_relative_path] - Dir.chdir(Dir.tmpdir) - File.basename(path) - else - path - end + Dir.chdir(Dir.tmpdir) + File.basename(path) + else + path + end Chef::Resource::File.new(use_path, run_context) end diff --git a/spec/support/shared/context/win32.rb b/spec/support/shared/context/win32.rb index 3dbe876114..60ed92ca1d 100644 --- a/spec/support/shared/context/win32.rb +++ b/spec/support/shared/context/win32.rb @@ -18,12 +18,12 @@ RSpec.shared_context "Win32" do before(:all) do @original_win32 = if defined?(Win32) - win32 = Object.send(:const_get, 'Win32') - Object.send(:remove_const, 'Win32') - win32 - else - nil - end + win32 = Object.send(:const_get, 'Win32') + Object.send(:remove_const, 'Win32') + win32 + else + nil + end Win32 = Module.new end diff --git a/spec/unit/application/knife_spec.rb b/spec/unit/application/knife_spec.rb index 8894e86240..0fb25176f9 100644 --- a/spec/unit/application/knife_spec.rb +++ b/spec/unit/application/knife_spec.rb @@ -1,6 +1,6 @@ # # Author:: AJ Christensen (<aj@junglist.gen.nz>) -# Copyright:: Copyright (c) 2008 Opscode, Inc. +# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -104,10 +104,10 @@ describe Chef::Application::Knife do it "does not expand a full path" do full_path = if windows? - 'C:/chef/client.pem' - else - '/etc/chef/client.pem' - end + 'C:/chef/client.pem' + else + '/etc/chef/client.pem' + end with_argv(*%W{noop knife command -k #{full_path}}) do expect(@knife).to receive(:exit).with(0) @knife.run diff --git a/spec/unit/knife/cookbook_site_install_spec.rb b/spec/unit/knife/cookbook_site_install_spec.rb index 07b268bb64..9779de4a64 100644 --- a/spec/unit/knife/cookbook_site_install_spec.rb +++ b/spec/unit/knife/cookbook_site_install_spec.rb @@ -1,6 +1,6 @@ # # Author:: Steven Danna (<steve@opscode.com>) -# Copyright:: Copyright (c) 2011 Opscode, Inc. +# Copyright:: Copyright (c) 2011-2016 Chef Software, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,11 +26,13 @@ describe Chef::Knife::CookbookSiteInstall do let(:repo) { double(:sanity_check => true, :reset_to_default_state => true, :prepare_to_import => true, :finalize_updates_to => true, :merge_updates_from => true) } - let(:install_path) { if Chef::Platform.windows? - 'C:/tmp/chef' - else - '/var/tmp/chef' - end } + let(:install_path) { + if Chef::Platform.windows? + 'C:/tmp/chef' + else + '/var/tmp/chef' + end + } before(:each) do require 'chef/knife/core/cookbook_scm_repo' diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb index f790bdb1ce..5e4d8a6224 100644 --- a/spec/unit/provider/package/rubygems_spec.rb +++ b/spec/unit/provider/package/rubygems_spec.rb @@ -223,10 +223,10 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do it "determines the installed versions of gems from the source index (part2: the unmockening)" do allow($stdout).to receive(:write) path_to_gem = if windows? - `where gem`.split[1] - else - `which gem`.strip - end + `where gem`.split[1] + else + `which gem`.strip + end skip("cant find your gem executable") if path_to_gem.empty? gem_env = Chef::Provider::Package::Rubygems::AlternateGemEnvironment.new(path_to_gem) expected = ['rspec-core', Gem::Version.new(RSpec::Core::Version::STRING)] @@ -261,7 +261,7 @@ RubyGems Environment: - REMOTE SOURCES: - https://rubygems.org/ - http://gems.github.com/ -JRUBY_GEM_ENV + JRUBY_GEM_ENV expect(@gem_env).to receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(double('jruby_gem_env', :stdout => gem_env_out)) expected = ['ruby', Gem::Platform.new('universal-java-1.6')] expect(@gem_env.gem_platforms).to eq(expected) @@ -303,7 +303,7 @@ RubyGems Environment: - REMOTE SOURCES: - https://rubygems.org/ - http://gems.github.com/ -RBX_GEM_ENV + RBX_GEM_ENV expect(@gem_env).to receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(double('rbx_gem_env', :stdout => gem_env_out)) expect(@gem_env.gem_platforms).to eq(Gem.platforms) expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache['/usr/weird/bin/gem']).to eq(Gem.platforms) @@ -459,8 +459,8 @@ describe Chef::Provider::Package::Rubygems do @provider.current_resource.version('0.0.1') version = Gem::Version.new(@spec_version) expect(@provider.gem_env).to receive(:candidate_version_from_remote). - with(Gem::Dependency.new('rspec-core', @spec_version), "http://mygems.example.com"). - and_return(version) + with(Gem::Dependency.new('rspec-core', @spec_version), "http://mygems.example.com"). + and_return(version) expect(@provider.candidate_version).to eq(@spec_version) end |