diff options
author | Thom May <thom@chef.io> | 2016-01-14 14:08:03 +0000 |
---|---|---|
committer | Thom May <thom@chef.io> | 2016-01-14 14:08:03 +0000 |
commit | 51cfbdc4d16739caac4d946fadbe678444aafe34 (patch) | |
tree | 56dfd8f1cd9fd933de27268b32402e955a43ac2b /spec/integration/client/client_spec.rb | |
parent | 05064423057d4cf46f4713b81b08829cf6d20af6 (diff) | |
download | chef-51cfbdc4d16739caac4d946fadbe678444aafe34.tar.gz |
Use double quotes by default
This is an entirely mechanically generated (chefstyle -a) change, to go
along with chef/chefstyle#5 . We should pick something and use it
consistently, and my opinion is that double quotes are the appropriate
thing.
Diffstat (limited to 'spec/integration/client/client_spec.rb')
-rw-r--r-- | spec/integration/client/client_spec.rb | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb index 5e72a94065..0ca784d468 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -1,13 +1,13 @@ -require 'support/shared/integration/integration_helper' -require 'chef/mixin/shell_out' -require 'tiny_server' -require 'tmpdir' +require "support/shared/integration/integration_helper" +require "chef/mixin/shell_out" +require "tiny_server" +require "tmpdir" describe "chef-client" do def recipes_filename - File.join(CHEF_SPEC_DATA, 'recipes.tgz') + File.join(CHEF_SPEC_DATA, "recipes.tgz") end def start_tiny_server(server_opts={}) @@ -48,13 +48,13 @@ describe "chef-client" do # cf. CHEF-4914 let(:chef_client) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" } - let(:critical_env_vars) { %w(PATH RUBYOPT BUNDLE_GEMFILE GEM_PATH).map {|o| "#{o}=#{ENV[o]}"} .join(' ') } + let(:critical_env_vars) { %w(PATH RUBYOPT BUNDLE_GEMFILE GEM_PATH).map {|o| "#{o}=#{ENV[o]}"} .join(" ") } when_the_repository "has a cookbook with a no-op recipe" do - before { file 'cookbooks/x/recipes/default.rb', '' } + before { file "cookbooks/x/recipes/default.rb", "" } it "should complete with success" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM local_mode true cookbook_path "#{path_to('cookbooks')}" EOM @@ -63,7 +63,7 @@ EOM end it "should complete successfully with no other environment variables", :skip => (Chef::Platform.windows?) do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM local_mode true cookbook_path "#{path_to('cookbooks')}" EOM @@ -79,7 +79,7 @@ EOM end it "should complete successfully with --no-listen" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM local_mode true cookbook_path "#{path_to('cookbooks')}" EOM @@ -90,32 +90,32 @@ EOM it "should be able to node.save with bad utf8 characters in the node data" do file "cookbooks/x/attributes/default.rb", 'default["badutf8"] = "Elan Ruusam\xE4e"' - result = shell_out("#{chef_client} -z -r 'x::default' --disable-config", :cwd => path_to('')) + result = shell_out("#{chef_client} -z -r 'x::default' --disable-config", :cwd => path_to("")) result.error! end - context 'and no config file' do - it 'should complete with success when cwd is just above cookbooks and paths are not specified' do - result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => path_to('')) + context "and no config file" do + it "should complete with success when cwd is just above cookbooks and paths are not specified" do + result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => path_to("")) result.error! end - it 'should complete with success when cwd is below cookbooks and paths are not specified' do - result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => path_to('cookbooks/x')) + it "should complete with success when cwd is below cookbooks and paths are not specified" do + result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => path_to("cookbooks/x")) result.error! end - it 'should fail when cwd is below high above and paths are not specified' do - result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => File.expand_path('..', path_to(''))) + it "should fail when cwd is below high above and paths are not specified" do + result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => File.expand_path("..", path_to(""))) expect(result.exitstatus).to eq(1) end end - context 'and a config file under .chef/knife.rb' do - before { file '.chef/knife.rb', 'xxx.xxx' } + context "and a config file under .chef/knife.rb" do + before { file ".chef/knife.rb", "xxx.xxx" } - it 'should load .chef/knife.rb when -z is specified' do - result = shell_out("#{chef_client} -z -o 'x::default'", :cwd => path_to('')) + it "should load .chef/knife.rb when -z is specified" do + result = shell_out("#{chef_client} -z -o 'x::default'", :cwd => path_to("")) # FATAL: Configuration error NoMethodError: undefined method `xxx' for nil:NilClass expect(result.stdout).to include("xxx") end @@ -123,7 +123,7 @@ EOM end it "should complete with success" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM local_mode true cookbook_path "#{path_to('cookbooks')}" EOM @@ -132,9 +132,9 @@ EOM result.error! end - context 'and a private key' do + context "and a private key" do before do - file 'mykey.pem', <<EOM + file "mykey.pem", <<EOM -----BEGIN RSA PRIVATE KEY----- MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf 0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk @@ -166,7 +166,7 @@ EOM end it "should complete with success even with a client key" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM local_mode true client_key #{path_to('mykey.pem').inspect} cookbook_path #{path_to('cookbooks').inspect} @@ -177,19 +177,19 @@ EOM end it "should run recipes specified directly on the command line" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM local_mode true client_key #{path_to('mykey.pem').inspect} cookbook_path #{path_to('cookbooks').inspect} EOM - file 'arbitrary.rb', <<EOM + file "arbitrary.rb", <<EOM file #{path_to('tempfile.txt').inspect} do content '1' end EOM - file 'arbitrary2.rb', <<EOM + file "arbitrary2.rb", <<EOM file #{path_to('tempfile2.txt').inspect} do content '2' end @@ -198,57 +198,57 @@ EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" #{path_to('arbitrary.rb')} #{path_to('arbitrary2.rb')}", :cwd => chef_dir) result.error! - expect(IO.read(path_to('tempfile.txt'))).to eq('1') - expect(IO.read(path_to('tempfile2.txt'))).to eq('2') + expect(IO.read(path_to("tempfile.txt"))).to eq("1") + expect(IO.read(path_to("tempfile2.txt"))).to eq("2") end it "should run recipes specified as relative paths directly on the command line" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM local_mode true client_key #{path_to('mykey.pem').inspect} cookbook_path #{path_to('cookbooks').inspect} EOM - file 'arbitrary.rb', <<EOM + file "arbitrary.rb", <<EOM file #{path_to('tempfile.txt').inspect} do content '1' end EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" arbitrary.rb", :cwd => path_to('')) + result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" arbitrary.rb", :cwd => path_to("")) result.error! - expect(IO.read(path_to('tempfile.txt'))).to eq('1') + expect(IO.read(path_to("tempfile.txt"))).to eq("1") end it "should run recipes specified directly on the command line AFTER recipes in the run list" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM local_mode true client_key #{path_to('mykey.pem').inspect} cookbook_path #{path_to('cookbooks').inspect} EOM - file 'cookbooks/x/recipes/constant_definition.rb', <<EOM + file "cookbooks/x/recipes/constant_definition.rb", <<EOM class ::Blah THECONSTANT = '1' end EOM - file 'arbitrary.rb', <<EOM + file "arbitrary.rb", <<EOM file #{path_to('tempfile.txt').inspect} do content ::Blah::THECONSTANT end EOM - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o x::constant_definition arbitrary.rb", :cwd => path_to('')) + result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o x::constant_definition arbitrary.rb", :cwd => path_to("")) result.error! - expect(IO.read(path_to('tempfile.txt'))).to eq('1') + expect(IO.read(path_to("tempfile.txt"))).to eq("1") end end it "should complete with success when passed the -z flag" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM chef_server_url 'http://omg.com/blah' cookbook_path "#{path_to('cookbooks')}" EOM @@ -258,7 +258,7 @@ EOM end it "should complete with success when passed the --local-mode flag" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM chef_server_url 'http://omg.com/blah' cookbook_path "#{path_to('cookbooks')}" EOM @@ -268,7 +268,7 @@ EOM end it "should not print SSL warnings when running in local-mode" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM chef_server_url 'http://omg.com/blah' cookbook_path "#{path_to('cookbooks')}" EOM @@ -279,7 +279,7 @@ EOM end it "should complete with success when passed -z and --chef-zero-port" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM chef_server_url 'http://omg.com/blah' cookbook_path "#{path_to('cookbooks')}" EOM @@ -289,7 +289,7 @@ EOM end it "should complete with success when setting the run list with -r" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM chef_server_url 'http://omg.com/blah' cookbook_path "#{path_to('cookbooks')}" EOM @@ -302,7 +302,7 @@ EOM end it "should complete with success when using --profile-ruby and output a profile file" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM local_mode true cookbook_path "#{path_to('cookbooks')}" EOM @@ -311,7 +311,7 @@ EOM end it "doesn't produce a profile when --profile-ruby is not present" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM local_mode true cookbook_path "#{path_to('cookbooks')}" EOM @@ -322,13 +322,13 @@ EOM when_the_repository "has a cookbook that should fail chef_version checks" do before do - file 'cookbooks/x/recipes/default.rb', '' - file 'cookbooks/x/metadata.rb', <<EOM + file "cookbooks/x/recipes/default.rb", "" + file "cookbooks/x/metadata.rb", <<EOM name 'x' version '0.0.1' chef_version '~> 999.99' EOM - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM local_mode true cookbook_path "#{path_to('cookbooks')}" EOM @@ -342,7 +342,7 @@ EOM when_the_repository "has a cookbook that uses cheffish resources" do before do - file 'cookbooks/x/recipes/default.rb', <<-EOM + file "cookbooks/x/recipes/default.rb", <<-EOM raise "Cheffish was loaded before we used any cheffish things!" if defined?(Cheffish::VERSION) ran_block = false got_server = with_chef_server 'https://blah.com' do @@ -353,7 +353,7 @@ EOM raise "Cheffish was not loaded when we did cheffish things!" if !defined?(Cheffish::VERSION) raise "current_chef_server did not return its value!" if got_server[:chef_server_url] != 'https://blah.com' EOM - file 'config/client.rb', <<-EOM + file "config/client.rb", <<-EOM local_mode true cookbook_path "#{path_to('cookbooks')}" EOM @@ -367,10 +367,10 @@ EOM when_the_repository "has a cookbook that uses chef-provisioning resources" do before do - file 'cookbooks/x/recipes/default.rb', <<-EOM + file "cookbooks/x/recipes/default.rb", <<-EOM with_driver 'blah' EOM - file 'config/client.rb', <<-EOM + file "config/client.rb", <<-EOM local_mode true cookbook_path "#{path_to('cookbooks')}" EOM @@ -385,7 +385,7 @@ EOM when_the_repository "has a cookbook that generates deprecation warnings" do before do - file 'cookbooks/x/recipes/default.rb', <<-EOM + file "cookbooks/x/recipes/default.rb", <<-EOM class ::MyResource < Chef::Resource use_automatic_resource_name property :x, default: [] @@ -412,7 +412,7 @@ EOM end it "should output each deprecation warning only once, at the end of the run" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM local_mode true cookbook_path "#{path_to('cookbooks')}" # Mimick what happens when you are on the console @@ -420,7 +420,7 @@ formatters << :doc log_level :warn EOM - ENV.delete('CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS') + ENV.delete("CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS") result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir) expect(result.error?).to be_falsey @@ -437,7 +437,7 @@ EOM when_the_repository "has a cookbook with only an audit recipe" do before do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM local_mode true cookbook_path "#{path_to('cookbooks')}" audit_mode :enabled @@ -445,7 +445,7 @@ EOM end it "should exit with a zero code when there is not an audit failure" do - file 'cookbooks/audit_test/recipes/succeed.rb', <<-RECIPE + file "cookbooks/audit_test/recipes/succeed.rb", <<-RECIPE control_group "control group without top level control" do it "should succeed" do expect(2 - 2).to eq(0) @@ -459,7 +459,7 @@ end end it "should exit with a non-zero code when there is an audit failure" do - file 'cookbooks/audit_test/recipes/fail.rb', <<-RECIPE + file "cookbooks/audit_test/recipes/fail.rb", <<-RECIPE control_group "control group without top level control" do it "should fail" do expect(2 - 2).to eq(1) @@ -486,14 +486,14 @@ end let(:tmp_dir) { Dir.mktmpdir("recipe-url") } it "should complete with success when passed -z and --recipe-url" do - file 'config/client.rb', <<EOM + file "config/client.rb", <<EOM chef_repo_path "#{tmp_dir}" EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --recipe-url=http://localhost:9000/recipes.tgz -o 'x::default' -z", :cwd => tmp_dir) result.error! end - it 'should fail when passed --recipe-url and not passed -z' do + it "should fail when passed --recipe-url and not passed -z" do result = shell_out("#{chef_client} --recipe-url=http://localhost:9000/recipes.tgz", :cwd => tmp_dir) expect(result.exitstatus).not_to eq(0) end |