diff options
Diffstat (limited to 'spec')
42 files changed, 136 insertions, 136 deletions
diff --git a/spec/functional/resource/deploy_revision_spec.rb b/spec/functional/resource/deploy_revision_spec.rb index 8b888ddf6a..c9f17f9702 100644 --- a/spec/functional/resource/deploy_revision_spec.rb +++ b/spec/functional/resource/deploy_revision_spec.rb @@ -193,7 +193,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do it "restarts the application" do expect(File).to exist(rel_path("current/restart.txt")) - expect(actual_operations_order).to eq(%w[deploy_to_latest_rev]) + expect(actual_operations_order).to eq(%w{deploy_to_latest_rev}) end it "is marked as updated" do @@ -214,7 +214,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do the_app_is_deployed_at_revision(:latest_rev) it "restarts the application after rolling back" do - expect(actual_operations_order).to eq(%w[deploy_to_latest_rev deploy_to_previous_rev deploy_to_latest_rev_again]) + expect(actual_operations_order).to eq(%w{deploy_to_latest_rev deploy_to_previous_rev deploy_to_latest_rev_again}) end it "is marked updated" do @@ -248,7 +248,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do it "restarts the application" do expect(File).to exist(rel_path("current/restart.txt")) - expect(actual_operations_order).to eq(%w[deploy_to_latest_rev]) + expect(actual_operations_order).to eq(%w{deploy_to_latest_rev}) end it "is marked as updated" do @@ -265,7 +265,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do the_app_is_deployed_at_revision(:latest_rev) it "does not restart the app" do - expect(actual_operations_order).to eq(%w[deploy_to_latest_rev]) + expect(actual_operations_order).to eq(%w{deploy_to_latest_rev}) end it "is not marked updated" do @@ -283,7 +283,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do the_app_is_deployed_at_revision(:latest_rev) it "restarts the app" do - expect(actual_operations_order).to eq(%w[deploy_to_latest_rev deploy_to_latest_rev_again]) + expect(actual_operations_order).to eq(%w{deploy_to_latest_rev deploy_to_latest_rev_again}) end it "is marked updated" do @@ -301,7 +301,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do the_app_is_deployed_at_revision(:latest_rev) it "restarts the application after the new deploy" do - expect(actual_operations_order).to eq(%w[deploy_to_previous_rev deploy_to_latest_rev]) + expect(actual_operations_order).to eq(%w{deploy_to_previous_rev deploy_to_latest_rev}) end it "is marked updated" do @@ -324,7 +324,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do the_app_is_deployed_at_revision(:latest_rev) it "restarts the application after rolling back" do - expect(actual_operations_order).to eq(%w[deploy_to_latest_rev deploy_to_previous_rev deploy_to_latest_rev_again]) + expect(actual_operations_order).to eq(%w{deploy_to_latest_rev deploy_to_previous_rev deploy_to_latest_rev_again}) end it "is marked updated" do @@ -349,7 +349,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do the_app_is_deployed_at_revision(:previous_rev) it "restarts the application after rolling back" do - expect(actual_operations_order).to eq(%w[deploy_to_previous_rev deploy_to_latest_rev deploy_to_latest_rev_again]) + expect(actual_operations_order).to eq(%w{deploy_to_previous_rev deploy_to_latest_rev deploy_to_latest_rev_again}) end it "is marked updated" do @@ -392,7 +392,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do the_app_is_deployed_at_revision(:previous_rev) it "restarts the application after rolling back" do - expect(actual_operations_order).to eq(%w[deploy_to_previous_rev deploy_to_latest_rev deploy_to_previous_rev_again]) + expect(actual_operations_order).to eq(%w{deploy_to_previous_rev deploy_to_latest_rev deploy_to_previous_rev_again}) end it "is marked updated" do @@ -437,7 +437,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do the_app_is_deployed_at_revision(:second_rev) it "restarts the application after rolling back" do - expect(actual_operations_order).to eq(%w[deploy_to_second_rev deploy_to_previous_rev deploy_to_previous_rev_again deploy_to_latest_rev deploy_to_latest_rev_again]) + expect(actual_operations_order).to eq(%w{deploy_to_second_rev deploy_to_previous_rev deploy_to_previous_rev_again deploy_to_latest_rev deploy_to_latest_rev_again}) end it "is marked updated" do @@ -474,7 +474,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do the_app_is_deployed_at_revision(:second_rev) it "restarts the application after rolling back" do - expect(actual_operations_order).to eq(%w[deploy_to_second_rev deploy_to_previous_rev deploy_to_second_rev_again deploy_to_latest_rev deploy_to_second_rev_again_again]) + expect(actual_operations_order).to eq(%w{deploy_to_second_rev deploy_to_previous_rev deploy_to_second_rev_again deploy_to_latest_rev deploy_to_second_rev_again_again}) end it "is marked updated" do @@ -689,7 +689,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do end it "runs migrations in between the before_migrate and before_symlink steps" do - expect(actual_operations_order).to eq(%w[before_migrate migration before_symlink before_restart after_restart]) + expect(actual_operations_order).to eq(%w{before_migrate migration before_symlink before_restart after_restart}) end end diff --git a/spec/functional/resource/user/useradd_spec.rb b/spec/functional/resource/user/useradd_spec.rb index 5ab6a403da..9335aa8505 100644 --- a/spec/functional/resource/user/useradd_spec.rb +++ b/spec/functional/resource/user/useradd_spec.rb @@ -644,7 +644,7 @@ describe Chef::Provider::User::Useradd, metadata do context "and has no password" do # TODO: platform_family should be setup in spec_helper w/ tags - if %w[suse opensuse].include?(OHAI_SYSTEM["platform_family"]) + if %w{suse opensuse}.include?(OHAI_SYSTEM["platform_family"]) # suse gets this right: it "errors out trying to unlock the user" do expect(@error).to be_a(Mixlib::ShellOut::ShellCommandFailed) diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb index 0ca784d468..d08935d854 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -48,7 +48,7 @@ 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", "" } diff --git a/spec/integration/client/ipv6_spec.rb b/spec/integration/client/ipv6_spec.rb index e8e8753731..5fa1d604db 100644 --- a/spec/integration/client/ipv6_spec.rb +++ b/spec/integration/client/ipv6_spec.rb @@ -76,7 +76,7 @@ END_CLIENT_RB let(:chef_dir) { File.join(File.dirname(__FILE__), "..", "..", "..", "bin") } - let(:chef_client_cmd) { %Q[ruby '#{chef_dir}/chef-client' --minimal-ohai -c "#{path_to('config/client.rb')}" -lwarn] } + let(:chef_client_cmd) { %Q{ruby '#{chef_dir}/chef-client' --minimal-ohai -c "#{path_to('config/client.rb')}" -lwarn} } after do FileUtils.rm_rf(cache_path) diff --git a/spec/integration/knife/chef_repo_path_spec.rb b/spec/integration/knife/chef_repo_path_spec.rb index b5c86d7a00..2795db0a7b 100644 --- a/spec/integration/knife/chef_repo_path_spec.rb +++ b/spec/integration/knife/chef_repo_path_spec.rb @@ -81,7 +81,7 @@ EOM context "when all _paths are set to alternates" do before :each do - %w(client cookbook data_bag environment node role user).each do |object_name| + %w{client cookbook data_bag environment node role user}.each do |object_name| Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, "#{object_name}s2") end Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "chef_repo2") @@ -162,7 +162,7 @@ EOM context "when all _paths except chef_repo_path are set to alternates" do before :each do - %w(client cookbook data_bag environment node role user).each do |object_name| + %w{client cookbook data_bag environment node role user}.each do |object_name| Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, "#{object_name}s2") end end @@ -218,7 +218,7 @@ EOM context "when only chef_repo_path is set to its alternate" do before :each do - %w(client cookbook data_bag environment node role user).each do |object_name| + %w{client cookbook data_bag environment node role user}.each do |object_name| Chef::Config.delete("#{object_name}_path".to_sym) end Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "chef_repo2") @@ -275,7 +275,7 @@ EOM context "when paths are set to point to both versions of each" do before :each do - %w(client cookbook data_bag environment node role user).each do |object_name| + %w{client cookbook data_bag environment node role user}.each do |object_name| Chef::Config["#{object_name}_path".to_sym] = [ File.join(Chef::Config.chef_repo_path, "#{object_name}s"), File.join(Chef::Config.chef_repo_path, "#{object_name}s2"), @@ -511,7 +511,7 @@ EOM context "when when chef_repo_path is set to both places and no other _path is set" do before :each do - %w(client cookbook data_bag environment node role user).each do |object_name| + %w{client cookbook data_bag environment node role user}.each do |object_name| Chef::Config.delete("#{object_name}_path".to_sym) end Chef::Config.chef_repo_path = [ @@ -613,7 +613,7 @@ EOM context "when cookbook_path is set and nothing else" do before :each do - %w(client data_bag environment node role user).each do |object_name| + %w{client data_bag environment node role user}.each do |object_name| Chef::Config.delete("#{object_name}_path".to_sym) end Chef::Config.delete(:chef_repo_path) @@ -671,7 +671,7 @@ EOM context "when cookbook_path is set to multiple places and nothing else is set" do before :each do - %w(client data_bag environment node role user).each do |object_name| + %w{client data_bag environment node role user}.each do |object_name| Chef::Config.delete("#{object_name}_path".to_sym) end Chef::Config.delete(:chef_repo_path) @@ -774,7 +774,7 @@ EOM context "when data_bag_path and chef_repo_path are set, and nothing else" do before :each do - %w(client cookbook environment node role user).each do |object_name| + %w{client cookbook environment node role user}.each do |object_name| Chef::Config.delete("#{object_name}_path".to_sym) end Chef::Config.data_bag_path = File.join(Chef::Config.chef_repo_path, "data_bags") @@ -834,7 +834,7 @@ EOM include_context "default config options" before :each do - %w(client cookbook environment node role user).each do |object_name| + %w{client cookbook environment node role user}.each do |object_name| Chef::Config.delete("#{object_name}_path".to_sym) end Chef::Config.delete(:chef_repo_path) @@ -871,7 +871,7 @@ EOM when_the_repository "is empty" do context "when the repository _paths point to places that do not exist" do before :each do - %w(client cookbook data_bag environment node role user).each do |object_name| + %w{client cookbook data_bag environment node role user}.each do |object_name| Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, "nowhere", object_name) end Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "nowhere") diff --git a/spec/integration/knife/deps_spec.rb b/spec/integration/knife/deps_spec.rb index 8348c601aa..a27d1d6b72 100644 --- a/spec/integration/knife/deps_spec.rb +++ b/spec/integration/knife/deps_spec.rb @@ -33,7 +33,7 @@ describe "knife deps", :workstation do when_the_repository "has a role with a default run_list" do before do - file "roles/starring.json", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } + file "roles/starring.json", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} } file "roles/minor.json", {} file "cookbooks/quiche/metadata.rb", 'name "quiche"' file "cookbooks/quiche/recipes/default.rb", "" @@ -52,7 +52,7 @@ EOM when_the_repository "has a role with an env_run_list" do before do - file "roles/starring.json", { "env_run_lists" => { "desert" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } } + file "roles/starring.json", { "env_run_lists" => { "desert" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} } } file "roles/minor.json", {} file "cookbooks/quiche/metadata.rb", 'name "quiche"' file "cookbooks/quiche/recipes/default.rb", "" @@ -91,7 +91,7 @@ EOM file "cookbooks/quiche/recipes/default.rb", "" file "cookbooks/soup/metadata.rb", 'name "soup"' file "cookbooks/soup/recipes/chicken.rb", "" - file "nodes/mort.json", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } + file "nodes/mort.json", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} } end it "knife deps reports just the node" do knife("deps /nodes/mort.json").should_succeed <<EOM @@ -136,7 +136,7 @@ depends "kettle"' end when_the_repository "has a deep dependency tree" do before do - file "roles/starring.json", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } + file "roles/starring.json", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} } file "roles/minor.json", {} file "cookbooks/quiche/metadata.rb", 'name "quiche"' file "cookbooks/quiche/recipes/default.rb", "" @@ -376,7 +376,7 @@ EOM when_the_chef_server "has a role with a default run_list" do before do - role "starring", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } + role "starring", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} } role "minor", {} cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } } cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } } @@ -393,7 +393,7 @@ EOM when_the_chef_server "has a role with an env_run_list" do before do - role "starring", { "env_run_lists" => { "desert" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } } + role "starring", { "env_run_lists" => { "desert" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} } } role "minor", {} cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } } cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } } @@ -428,7 +428,7 @@ EOM role "minor", {} cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } } cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } } - node "mort", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } + node "mort", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} } end it "knife deps reports just the node" do knife("deps --remote /nodes/mort.json").should_succeed <<EOM @@ -471,7 +471,7 @@ depends "kettle"', "recipes" => { "default.rb" => "" } } end when_the_chef_server "has a deep dependency tree" do before do - role "starring", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } + role "starring", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} } role "minor", {} cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } } cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2d95ddcae9..e69d61a7b3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -51,7 +51,7 @@ require "chef/knife" Dir["lib/chef/knife/**/*.rb"]. map {|f| f.gsub("lib/", "") }. - map {|f| f.gsub(%r[\.rb$], "") }. + map {|f| f.gsub(%r{\.rb$}, "") }. each {|f| require f } require "chef/resource_resolver" @@ -82,7 +82,7 @@ Dir["spec/support/**/*.rb"]. reject { |f| f =~ %r{^spec/support/platforms} }. reject { |f| f =~ %r{^spec/support/pedant} }. map { |f| f.gsub(%r{.rb$}, "") }. - map { |f| f.gsub(%r[spec/], "")}. + map { |f| f.gsub(%r{spec/}, "")}. each { |f| require f } OHAI_SYSTEM = Ohai::System.new diff --git a/spec/support/shared/integration/integration_helper.rb b/spec/support/shared/integration/integration_helper.rb index a19c9b35e7..6d3e3d3f5e 100644 --- a/spec/support/shared/integration/integration_helper.rb +++ b/spec/support/shared/integration/integration_helper.rb @@ -113,7 +113,7 @@ module IntegrationSupport raise "Can only create one directory per test" if @repository_dir @repository_dir = Dir.mktmpdir("chef_repo") Chef::Config.chef_repo_path = @repository_dir - %w(client cookbook data_bag environment node role user).each do |object_name| + %w{client cookbook data_bag environment node role user}.each do |object_name| Chef::Config.delete("#{object_name}_path".to_sym) end end @@ -121,7 +121,7 @@ module IntegrationSupport after :each do if @repository_dir begin - %w(client cookbook data_bag environment node role user).each do |object_name| + %w{client cookbook data_bag environment node role user}.each do |object_name| Chef::Config.delete("#{object_name}_path".to_sym) end Chef::Config.delete(:chef_repo_path) diff --git a/spec/support/shared/unit/provider/useradd_based_user_provider.rb b/spec/support/shared/unit/provider/useradd_based_user_provider.rb index 07fe1f772b..b4d640d046 100644 --- a/spec/support/shared/unit/provider/useradd_based_user_provider.rb +++ b/spec/support/shared/unit/provider/useradd_based_user_provider.rb @@ -108,7 +108,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option end it "should set -m -d /homedir" do - expect(provider.universal_options).to eq(%w[-d /wowaweea -m]) + expect(provider.universal_options).to eq(%w{-d /wowaweea -m}) expect(provider.useradd_options).to eq([]) end end @@ -121,7 +121,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option end it "should set -m -d /homedir" do - expect(provider.universal_options).to eql(%w[-d /wowaweea -m]) + expect(provider.universal_options).to eql(%w{-d /wowaweea -m}) expect(provider.useradd_options).to eq([]) end end diff --git a/spec/unit/application/client_spec.rb b/spec/unit/application/client_spec.rb index 6ff9597b53..67ef77615e 100644 --- a/spec/unit/application/client_spec.rb +++ b/spec/unit/application/client_spec.rb @@ -51,7 +51,7 @@ describe Chef::Application::Client, "reconfigure" do context "when given a named_run_list" do before do - ARGV.replace( %w[ --named-run-list arglebargle-example ] ) + ARGV.replace( %w{ --named-run-list arglebargle-example } ) app.reconfigure end diff --git a/spec/unit/chef_fs/data_handler/group_handler_spec.rb b/spec/unit/chef_fs/data_handler/group_handler_spec.rb index 7cbd0e4c22..230fb7bd36 100644 --- a/spec/unit/chef_fs/data_handler/group_handler_spec.rb +++ b/spec/unit/chef_fs/data_handler/group_handler_spec.rb @@ -36,16 +36,16 @@ describe Chef::ChefFS::DataHandler::GroupDataHandler do let(:group) do { "name" => "worker_bees", - "clients" => %w(honey sting), - "users" => %w(fizz buzz), - "actors" => %w(honey), + "clients" => %w{honey sting}, + "users" => %w{fizz buzz}, + "actors" => %w{honey}, } end let(:normalized) do { "actors" => - { "users" => %w(fizz buzz), - "clients"=> %w(honey sting), + { "users" => %w{fizz buzz}, + "clients"=> %w{honey sting}, "groups"=> [], }, "groupname" => "workers", diff --git a/spec/unit/chef_fs/parallelizer.rb b/spec/unit/chef_fs/parallelizer.rb index 0d667098a8..8f6f9e71fc 100644 --- a/spec/unit/chef_fs/parallelizer.rb +++ b/spec/unit/chef_fs/parallelizer.rb @@ -45,7 +45,7 @@ describe Chef::ChefFS::Parallelizer do expect(parallelize(1.upto(10), :ordered => false) do |i| sleep 0.2 "x" - end.to_a).to eq(%w(x x x x x x x x x x)) + end.to_a).to eq(%w{x x x x x x x x x x}) expect(elapsed_time).to be < 0.5 end @@ -117,7 +117,7 @@ describe Chef::ChefFS::Parallelizer do expect(parallelize(1.upto(10), :ordered => true) do |i| sleep 0.2 "x" - end.to_a).to eq(%w(x x x x x x x x x x)) + end.to_a).to eq(%w{x x x x x x x x x x}) expect(elapsed_time).to be < 0.5 end diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb index 8ac62cce2b..3b4d23da6e 100644 --- a/spec/unit/client_spec.rb +++ b/spec/unit/client_spec.rb @@ -38,7 +38,7 @@ describe Chef::Client do end it "runs ohai with only the minimum required plugins" do - expected_filter = %w[fqdn machinename hostname platform platform_version os os_version] + expected_filter = %w{fqdn machinename hostname platform platform_version os os_version} expect(ohai_system).to receive(:all_plugins).with(expected_filter) client.run_ohai end diff --git a/spec/unit/config_fetcher_spec.rb b/spec/unit/config_fetcher_spec.rb index 417087d9a3..794940c39a 100644 --- a/spec/unit/config_fetcher_spec.rb +++ b/spec/unit/config_fetcher_spec.rb @@ -7,7 +7,7 @@ describe Chef::ConfigFetcher do let(:http) { double("Chef::HTTP::Simple") } let(:config_location_regex) { Regexp.escape(config_location) } - let(:invalid_json_error_regex) { %r[Could not parse the provided JSON file \(#{config_location_regex}\)] } + let(:invalid_json_error_regex) { %r{Could not parse the provided JSON file \(#{config_location_regex}\)} } let(:fetcher) { Chef::ConfigFetcher.new(config_location) } diff --git a/spec/unit/cookbook/chefignore_spec.rb b/spec/unit/cookbook/chefignore_spec.rb index 9d81981dcf..89ab53b26d 100644 --- a/spec/unit/cookbook/chefignore_spec.rb +++ b/spec/unit/cookbook/chefignore_spec.rb @@ -23,12 +23,12 @@ describe Chef::Cookbook::Chefignore do end it "loads the globs in the chefignore file" do - expect(@chefignore.ignores).to match_array(%w[recipes/ignoreme.rb ignored]) + expect(@chefignore.ignores).to match_array(%w{recipes/ignoreme.rb ignored}) end it "removes items from an array that match the ignores" do - file_list = %w[ recipes/ignoreme.rb recipes/dontignoreme.rb ] - expect(@chefignore.remove_ignores_from(file_list)).to eq(%w[recipes/dontignoreme.rb]) + file_list = %w{ recipes/ignoreme.rb recipes/dontignoreme.rb } + expect(@chefignore.remove_ignores_from(file_list)).to eq(%w{recipes/dontignoreme.rb}) end it "determines if a file is ignored" do @@ -43,7 +43,7 @@ describe Chef::Cookbook::Chefignore do end it "loads the globs in the chefignore file" do - expect(@chefignore.ignores).to match_array(%w[recipes/ignoreme.rb ignored vendor/bundle/*]) + expect(@chefignore.ignores).to match_array(%w{recipes/ignoreme.rb ignored vendor/bundle/*}) end end end diff --git a/spec/unit/cookbook/file_vendor_spec.rb b/spec/unit/cookbook/file_vendor_spec.rb index 2420718dea..134e8d7e25 100644 --- a/spec/unit/cookbook/file_vendor_spec.rb +++ b/spec/unit/cookbook/file_vendor_spec.rb @@ -68,7 +68,7 @@ describe Chef::Cookbook::FileVendor do context "when configured to load files from disk" do - let(:cookbook_path) { %w[/var/chef/cookbooks /var/chef/other_cookbooks] } + let(:cookbook_path) { %w{/var/chef/cookbooks /var/chef/other_cookbooks} } # A manifest is a Hash of the format defined by Chef::CookbookVersion#manifest let(:manifest) { {:cookbook_name => "bob"} } diff --git a/spec/unit/cookbook/synchronizer_spec.rb b/spec/unit/cookbook/synchronizer_spec.rb index 17803a8392..d8f7f7d293 100644 --- a/spec/unit/cookbook/synchronizer_spec.rb +++ b/spec/unit/cookbook/synchronizer_spec.rb @@ -123,7 +123,7 @@ describe Chef::CookbookSynchronizer do end it "lists the cookbook names" do - expect(synchronizer.cookbook_names).to eq(%w[cookbook_a]) + expect(synchronizer.cookbook_names).to eq(%w{cookbook_a}) end it "lists the cookbook manifests" do diff --git a/spec/unit/cookbook_version_spec.rb b/spec/unit/cookbook_version_spec.rb index 856dc00006..0e330b2130 100644 --- a/spec/unit/cookbook_version_spec.rb +++ b/spec/unit/cookbook_version_spec.rb @@ -285,7 +285,7 @@ describe Chef::CookbookVersion do @cbv = Chef::CookbookVersion.new("version validation", "/tmp/blah") end it "should accept valid cookbook versions" do - good_versions = %w(1.2 1.2.3 1000.80.50000 0.300.25) + good_versions = %w{1.2 1.2.3 1000.80.50000 0.300.25} good_versions.each do |v| @cbv.version = v end diff --git a/spec/unit/dsl/data_query_spec.rb b/spec/unit/dsl/data_query_spec.rb index 34d4cfdba3..22cb3f2db6 100644 --- a/spec/unit/dsl/data_query_spec.rb +++ b/spec/unit/dsl/data_query_spec.rb @@ -37,7 +37,7 @@ describe Chef::DSL::DataQuery do allow(Chef::DataBag).to receive(:load) .with("bag_name") .and_return("item_1" => "http://url_for/item_1", "item_2" => "http://url_for/item_2") - expect( language.data_bag("bag_name").sort ).to eql %w(item_1 item_2) + expect( language.data_bag("bag_name").sort ).to eql %w{item_1 item_2} end end diff --git a/spec/unit/environment_spec.rb b/spec/unit/environment_spec.rb index 0f3ee17872..04f54688de 100644 --- a/spec/unit/environment_spec.rb +++ b/spec/unit/environment_spec.rb @@ -317,7 +317,7 @@ describe Chef::Environment do it "validates the name given in the params" do expect(@environment.update_from_params(:name => "@$%^&*()")).to be_falsey - expect(@environment.invalid_fields[:name]).to eq(%q|Option name's value @$%^&*() does not match regular expression /^[\-[:alnum:]_]+$/|) + expect(@environment.invalid_fields[:name]).to eq(%q{Option name's value @$%^&*() does not match regular expression /^[\-[:alnum:]_]+$/}) end it "updates the description from parameters[:description]" do diff --git a/spec/unit/key_spec.rb b/spec/unit/key_spec.rb index 95124b5e8f..b361b5e419 100644 --- a/spec/unit/key_spec.rb +++ b/spec/unit/key_spec.rb @@ -199,7 +199,7 @@ EOS end it "should include the actor value under the key relative to the actor_field_name passed" do - expect(json).to include(%Q("#{new_key.actor_field_name}":"original_actor")) + expect(json).to include(%Q{"#{new_key.actor_field_name}":"original_actor"}) end it "should include the name field when present" do @@ -213,7 +213,7 @@ EOS it "should include the public_key field when present" do new_key.public_key "this_public_key" - expect(new_key.to_json).to include(%q("public_key":"this_public_key")) + expect(new_key.to_json).to include(%q{"public_key":"this_public_key"}) end it "should not include the public_key if not present" do @@ -222,7 +222,7 @@ EOS it "should include the private_key field when present" do new_key.private_key "this_public_key" - expect(new_key.to_json).to include(%q("private_key":"this_public_key")) + expect(new_key.to_json).to include(%q{"private_key":"this_public_key"}) end it "should not include the private_key if not present" do @@ -231,7 +231,7 @@ EOS it "should include the expiration_date field when present" do new_key.expiration_date "2020-12-24T21:00:00Z" - expect(new_key.to_json).to include(%Q("expiration_date":"2020-12-24T21:00:00Z")) + expect(new_key.to_json).to include(%Q{"expiration_date":"2020-12-24T21:00:00Z"}) end it "should not include the expiration_date if not present" do @@ -240,7 +240,7 @@ EOS it "should include the create_key field when present" do new_key.create_key true - expect(new_key.to_json).to include(%q("create_key":true)) + expect(new_key.to_json).to include(%q{"create_key":true}) end it "should not include the create_key if not present" do diff --git a/spec/unit/knife/bootstrap/client_builder_spec.rb b/spec/unit/knife/bootstrap/client_builder_spec.rb index 791b84b9c3..ee6b1a1ffa 100644 --- a/spec/unit/knife/bootstrap/client_builder_spec.rb +++ b/spec/unit/knife/bootstrap/client_builder_spec.rb @@ -161,11 +161,11 @@ describe Chef::Knife::Bootstrap::ClientBuilder do it "adds tags to the node when given" do tag_receiver = [] - knife_config[:tags] = %w[foo bar] + knife_config[:tags] = %w{foo bar} allow(node).to receive(:run_list).with([]) allow(node).to receive(:tags).and_return(tag_receiver) client_builder.run - expect(tag_receiver).to eq %w[foo bar] + expect(tag_receiver).to eq %w{foo bar} end it "builds a node when the run_list is a string" do diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb index c64b2e49ea..0f9e6e3c39 100644 --- a/spec/unit/knife/bootstrap_spec.rb +++ b/spec/unit/knife/bootstrap_spec.rb @@ -426,7 +426,7 @@ describe Chef::Knife::Bootstrap do context "when only policy_name is given" do - let(:bootstrap_cli_options) { %w[ --policy-name my-app-server ] } + let(:bootstrap_cli_options) { %w{ --policy-name my-app-server } } it "returns an error stating that policy_name and policy_group must be given together" do expect { knife.validate_options! }.to raise_error(SystemExit) @@ -437,7 +437,7 @@ describe Chef::Knife::Bootstrap do context "when only policy_group is given" do - let(:bootstrap_cli_options) { %w[ --policy-group staging ] } + let(:bootstrap_cli_options) { %w{ --policy-group staging } } it "returns an error stating that policy_name and policy_group must be given together" do expect { knife.validate_options! }.to raise_error(SystemExit) @@ -448,7 +448,7 @@ describe Chef::Knife::Bootstrap do context "when both policy_name and policy_group are given, but run list is also given" do - let(:bootstrap_cli_options) { %w[ --policy-name my-app --policy-group staging --run-list cookbook ] } + let(:bootstrap_cli_options) { %w{ --policy-name my-app --policy-group staging --run-list cookbook } } it "returns an error stating that policyfile and run_list are exclusive" do expect { knife.validate_options! }.to raise_error(SystemExit) @@ -459,7 +459,7 @@ describe Chef::Knife::Bootstrap do context "when policy_name and policy_group are given with no conflicting options" do - let(:bootstrap_cli_options) { %w[ --policy-name my-app --policy-group staging ] } + let(:bootstrap_cli_options) { %w{ --policy-name my-app --policy-group staging } } it "passes options validation" do expect { knife.validate_options! }.to_not raise_error diff --git a/spec/unit/knife/core/gem_glob_loader_spec.rb b/spec/unit/knife/core/gem_glob_loader_spec.rb index 671fabf695..de632f23c1 100644 --- a/spec/unit/knife/core/gem_glob_loader_spec.rb +++ b/spec/unit/knife/core/gem_glob_loader_spec.rb @@ -40,7 +40,7 @@ describe Chef::Knife::SubcommandLoader::GemGlobLoader do it "finds files installed via rubygems" do expect(loader.find_subcommands_via_rubygems).to include("chef/knife/node_create") - loader.find_subcommands_via_rubygems.each {|rel_path, abs_path| expect(abs_path).to match(%r[chef/knife/.+])} + loader.find_subcommands_via_rubygems.each {|rel_path, abs_path| expect(abs_path).to match(%r{chef/knife/.+})} end it "finds files from latest version of installed gems" do @@ -65,7 +65,7 @@ describe Chef::Knife::SubcommandLoader::GemGlobLoader do it "finds files using a dirglob when rubygems is not available" do expect(loader.find_subcommands_via_dirglob).to include("chef/knife/node_create") - loader.find_subcommands_via_dirglob.each {|rel_path, abs_path| expect(abs_path).to match(%r[chef/knife/.+])} + loader.find_subcommands_via_dirglob.each {|rel_path, abs_path| expect(abs_path).to match(%r{chef/knife/.+})} end it "finds user-specific subcommands in the user's ~/.chef directory" do diff --git a/spec/unit/knife/core/node_editor_spec.rb b/spec/unit/knife/core/node_editor_spec.rb index 2c1beb6ccb..e64faebf6b 100644 --- a/spec/unit/knife/core/node_editor_spec.rb +++ b/spec/unit/knife/core/node_editor_spec.rb @@ -29,7 +29,7 @@ describe Chef::Knife::NodeEditor do "override" => { "alpha" => { "bravo" => "foxtrot", "delta" => "golf" } }, "policy_name" => nil, "policy_group" => nil, - "run_list" => %w(role[comedy] role[drama] recipe[mystery]), + "run_list" => %w{role[comedy] role[drama] recipe[mystery]}, } end @@ -45,8 +45,8 @@ describe Chef::Knife::NodeEditor do it "returns a Hash with only the name, chef_environment, normal, " + "policy_name, policy_group, and run_list properties" do expected = node_data.select do |key,| - %w[ name chef_environment normal - policy_name policy_group run_list ].include?(key) + %w{ name chef_environment normal + policy_name policy_group run_list }.include?(key) end expect(subject.view).to eq(expected) @@ -91,7 +91,7 @@ describe Chef::Knife::NodeEditor do "normal" => { "alpha" => { "bravo" => "hotel2" }, "tags" => [ "xyz" ] }, "policy_name" => "mypolicy", "policy_group" => "prod", - "run_list" => %w(role[drama] recipe[mystery]), + "run_list" => %w{role[drama] recipe[mystery]}, ) end @@ -123,7 +123,7 @@ describe Chef::Knife::NodeEditor do "override" => { "alpha" => { "bravo" => "foxtrot2", "delta" => "golf2" } }, "policy_name" => "mypolicy", "policy_group" => "prod", - "run_list" => %w(role[drama] recipe[mystery]), + "run_list" => %w{role[drama] recipe[mystery]}, ) end @@ -159,7 +159,7 @@ describe Chef::Knife::NodeEditor do "override" => { "alpha" => { "bravo" => "foxtrot2", "delta" => "golf2" } }, "policy_name" => "mypolicy", "policy_group" => "prod", - "run_list" => %w(role[drama] recipe[mystery]), + "run_list" => %w{role[drama] recipe[mystery]}, ) end @@ -173,7 +173,7 @@ describe Chef::Knife::NodeEditor do end it "returns an array of the changed property names" do - expect(subject.updated?).to eql %w[ normal policy_name policy_group run_list ] + expect(subject.updated?).to eql %w{ normal policy_name policy_group run_list } end end @@ -190,7 +190,7 @@ describe Chef::Knife::NodeEditor do it 'returns an array of property names that doesn\'t include ' + "the non-editable properties" do - expect(subject.updated?).to eql %w[ normal policy_name policy_group run_list ] + expect(subject.updated?).to eql %w{ normal policy_name policy_group run_list } end end end diff --git a/spec/unit/knife/data_bag_show_spec.rb b/spec/unit/knife/data_bag_show_spec.rb index 427d3e4d1b..76f041bcb3 100644 --- a/spec/unit/knife/data_bag_show_spec.rb +++ b/spec/unit/knife/data_bag_show_spec.rb @@ -70,9 +70,9 @@ describe Chef::Knife::DataBagShow do expect(knife.ui).to receive(:info).with("Encrypted data bag detected, decrypting with provided secret.") expect(Chef::EncryptedDataBagItem).to receive(:load).with(bag_name, item_name, secret).and_return(enc_data_bag) - expected = %q|baz: http://localhost:4000/data/bag_o_data/baz + expected = %q{baz: http://localhost:4000/data/bag_o_data/baz id: id -qux: http://localhost:4000/data/bag_o_data/qux| +qux: http://localhost:4000/data/bag_o_data/qux} knife.run expect(stdout.string.strip).to eq(expected) end @@ -97,9 +97,9 @@ qux: http://localhost:4000/data/bag_o_data/qux| expect(Chef::DataBagItem).to receive(:load).with(bag_name, item_name).and_return(data_bag) expect(knife.ui).to receive(:info).with("Unencrypted data bag detected, ignoring any provided secret options.") - expected = %q|baz: http://localhost:4000/data/bag_o_data/baz + expected = %q{baz: http://localhost:4000/data/bag_o_data/baz id: id -qux: http://localhost:4000/data/bag_o_data/qux| +qux: http://localhost:4000/data/bag_o_data/qux} knife.run expect(stdout.string.strip).to eq(expected) end diff --git a/spec/unit/knife/node_bulk_delete_spec.rb b/spec/unit/knife/node_bulk_delete_spec.rb index 7106fdfc7b..da54ce87c3 100644 --- a/spec/unit/knife/node_bulk_delete_spec.rb +++ b/spec/unit/knife/node_bulk_delete_spec.rb @@ -44,7 +44,7 @@ describe Chef::Knife::NodeBulkDelete do # I hate not having == defined for anything :( actual = @knife.all_nodes expect(actual.keys).to match_array(expected.keys) - expect(actual.values.map {|n| n.name }).to match_array(%w[adam brent jacob]) + expect(actual.values.map {|n| n.name }).to match_array(%w{adam brent jacob}) end end diff --git a/spec/unit/knife/tag_list_spec.rb b/spec/unit/knife/tag_list_spec.rb index 97cd8e7efa..dceec9a5ea 100644 --- a/spec/unit/knife/tag_list_spec.rb +++ b/spec/unit/knife/tag_list_spec.rb @@ -14,7 +14,7 @@ describe Chef::Knife::TagList do describe "run" do it "can list tags on a node" do - expected = %w(sadtag happytag) + expected = %w{sadtag happytag} expect(@node.tags).to eq(expected) expect(@knife).to receive(:output).with(expected) @knife.run diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb index 06892af905..a8b73212fe 100644 --- a/spec/unit/knife_spec.rb +++ b/spec/unit/knife_spec.rb @@ -311,7 +311,7 @@ describe Chef::Knife do end it "merges `listen` config to Chef::Config" do - Chef::Knife.run(%w[test yourself --no-listen], Chef::Application::Knife.options) + Chef::Knife.run(%w{test yourself --no-listen}, Chef::Application::Knife.options) expect(Chef::Config[:listen]).to be(false) end @@ -396,8 +396,8 @@ describe Chef::Knife do allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("403 Forbidden", response)) allow(knife).to receive(:username).and_return("sadpanda") knife.run_with_pretty_exceptions - expect(stderr.string).to match(%r[ERROR: You authenticated successfully to http.+ as sadpanda but you are not authorized for this action]) - expect(stderr.string).to match(%r[Response: y u no administrator]) + expect(stderr.string).to match(%r{ERROR: You authenticated successfully to http.+ as sadpanda but you are not authorized for this action}) + expect(stderr.string).to match(%r{Response: y u no administrator}) end it "formats 400s nicely" do @@ -406,8 +406,8 @@ describe Chef::Knife do allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "y u search wrong")) allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("400 Bad Request", response)) knife.run_with_pretty_exceptions - expect(stderr.string).to match(%r[ERROR: The data in your request was invalid]) - expect(stderr.string).to match(%r[Response: y u search wrong]) + expect(stderr.string).to match(%r{ERROR: The data in your request was invalid}) + expect(stderr.string).to match(%r{Response: y u search wrong}) end it "formats 404s nicely" do @@ -416,8 +416,8 @@ describe Chef::Knife do allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "nothing to see here")) allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("404 Not Found", response)) knife.run_with_pretty_exceptions - expect(stderr.string).to match(%r[ERROR: The object you are looking for could not be found]) - expect(stderr.string).to match(%r[Response: nothing to see here]) + expect(stderr.string).to match(%r{ERROR: The object you are looking for could not be found}) + expect(stderr.string).to match(%r{Response: nothing to see here}) end it "formats 406s (non-supported API version error) nicely" do @@ -442,8 +442,8 @@ describe Chef::Knife do allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "sad trombone")) allow(knife).to receive(:run).and_raise(Net::HTTPFatalError.new("500 Internal Server Error", response)) knife.run_with_pretty_exceptions - expect(stderr.string).to match(%r[ERROR: internal server error]) - expect(stderr.string).to match(%r[Response: sad trombone]) + expect(stderr.string).to match(%r{ERROR: internal server error}) + expect(stderr.string).to match(%r{Response: sad trombone}) end it "formats 502s nicely" do @@ -452,8 +452,8 @@ describe Chef::Knife do allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "sadder trombone")) allow(knife).to receive(:run).and_raise(Net::HTTPFatalError.new("502 Bad Gateway", response)) knife.run_with_pretty_exceptions - expect(stderr.string).to match(%r[ERROR: bad gateway]) - expect(stderr.string).to match(%r[Response: sadder trombone]) + expect(stderr.string).to match(%r{ERROR: bad gateway}) + expect(stderr.string).to match(%r{Response: sadder trombone}) end it "formats 503s nicely" do @@ -462,8 +462,8 @@ describe Chef::Knife do allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "saddest trombone")) allow(knife).to receive(:run).and_raise(Net::HTTPFatalError.new("503 Service Unavailable", response)) knife.run_with_pretty_exceptions - expect(stderr.string).to match(%r[ERROR: Service temporarily unavailable]) - expect(stderr.string).to match(%r[Response: saddest trombone]) + expect(stderr.string).to match(%r{ERROR: Service temporarily unavailable}) + expect(stderr.string).to match(%r{Response: saddest trombone}) end it "formats other HTTP errors nicely" do @@ -472,24 +472,24 @@ describe Chef::Knife do allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "nobugfixtillyoubuy")) allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("402 Payment Required", response)) knife.run_with_pretty_exceptions - expect(stderr.string).to match(%r[ERROR: Payment Required]) - expect(stderr.string).to match(%r[Response: nobugfixtillyoubuy]) + expect(stderr.string).to match(%r{ERROR: Payment Required}) + expect(stderr.string).to match(%r{Response: nobugfixtillyoubuy}) end it "formats NameError and NoMethodError nicely" do allow(knife).to receive(:run).and_raise(NameError.new("Undefined constant FUUU")) knife.run_with_pretty_exceptions - expect(stderr.string).to match(%r[ERROR: knife encountered an unexpected error]) - expect(stderr.string).to match(%r[This may be a bug in the 'knife' knife command or plugin]) - expect(stderr.string).to match(%r[Exception: NameError: Undefined constant FUUU]) + expect(stderr.string).to match(%r{ERROR: knife encountered an unexpected error}) + expect(stderr.string).to match(%r{This may be a bug in the 'knife' knife command or plugin}) + expect(stderr.string).to match(%r{Exception: NameError: Undefined constant FUUU}) end it "formats missing private key errors nicely" do allow(knife).to receive(:run).and_raise(Chef::Exceptions::PrivateKeyMissing.new("key not there")) allow(knife).to receive(:api_key).and_return("/home/root/.chef/no-key-here.pem") knife.run_with_pretty_exceptions - expect(stderr.string).to match(%r[ERROR: Your private key could not be loaded from /home/root/.chef/no-key-here.pem]) - expect(stderr.string).to match(%r[Check your configuration file and ensure that your private key is readable]) + expect(stderr.string).to match(%r{ERROR: Your private key could not be loaded from /home/root/.chef/no-key-here.pem}) + expect(stderr.string).to match(%r{Check your configuration file and ensure that your private key is readable}) end it "formats connection refused errors nicely" do @@ -498,8 +498,8 @@ describe Chef::Knife do # Errno::ECONNREFUSED message differs by platform # *nix = Errno::ECONNREFUSED: Connection refused # win32: Errno::ECONNREFUSED: No connection could be made because the target machine actively refused it. - expect(stderr.string).to match(%r[ERROR: Network Error: .* - y u no shut up]) - expect(stderr.string).to match(%r[Check your knife configuration and network settings]) + expect(stderr.string).to match(%r{ERROR: Network Error: .* - y u no shut up}) + expect(stderr.string).to match(%r{Check your knife configuration and network settings}) end it "formats SSL errors nicely and suggests to use `knife ssl check` and `knife ssl fetch`" do diff --git a/spec/unit/mixin/deep_merge_spec.rb b/spec/unit/mixin/deep_merge_spec.rb index 1212ff2b53..a725fdecbc 100644 --- a/spec/unit/mixin/deep_merge_spec.rb +++ b/spec/unit/mixin/deep_merge_spec.rb @@ -304,25 +304,25 @@ describe Chef::Mixin::DeepMerge do end it "replaces arrays rather than merging them" do - merge_ee_hash = {"top_level_a" => {"1_deep_a" => "1-a-merge-ee", "1_deep_b" => %w[A A A]}, "top_level_b" => "top-level-b-merge-ee"} - merge_with_hash = {"top_level_a" => {"1_deep_b" => %w[B B B], "1_deep_c" => "1-deep-c-merged-onto"}, "top_level_b" => "top-level-b-merged-onto" } + merge_ee_hash = {"top_level_a" => {"1_deep_a" => "1-a-merge-ee", "1_deep_b" => %w{A A A}}, "top_level_b" => "top-level-b-merge-ee"} + merge_with_hash = {"top_level_a" => {"1_deep_b" => %w{B B B}, "1_deep_c" => "1-deep-c-merged-onto"}, "top_level_b" => "top-level-b-merged-onto" } merged_result = @dm.hash_only_merge(merge_ee_hash, merge_with_hash) expect(merged_result["top_level_b"]).to eq("top-level-b-merged-onto") expect(merged_result["top_level_a"]["1_deep_a"]).to eq("1-a-merge-ee") - expect(merged_result["top_level_a"]["1_deep_b"]).to eq(%w[B B B]) + expect(merged_result["top_level_a"]["1_deep_b"]).to eq(%w{B B B}) end it "replaces non-hash items with hashes when there's a conflict" do merge_ee_hash = {"top_level_a" => "top-level-a-mergee", "top_level_b" => "top-level-b-merge-ee"} - merge_with_hash = {"top_level_a" => {"1_deep_b" => %w[B B B], "1_deep_c" => "1-deep-c-merged-onto"}, "top_level_b" => "top-level-b-merged-onto" } + merge_with_hash = {"top_level_a" => {"1_deep_b" => %w{B B B}, "1_deep_c" => "1-deep-c-merged-onto"}, "top_level_b" => "top-level-b-merged-onto" } merged_result = @dm.hash_only_merge(merge_ee_hash, merge_with_hash) expect(merged_result["top_level_a"]).to be_a(Hash) expect(merged_result["top_level_a"]["1_deep_a"]).to be_nil - expect(merged_result["top_level_a"]["1_deep_b"]).to eq(%w[B B B]) + expect(merged_result["top_level_a"]["1_deep_b"]).to eq(%w{B B B}) end it "does not mutate deeply-nested original hashes by default" do diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb index dfa6f33122..1f962dfa3e 100644 --- a/spec/unit/node/attribute_spec.rb +++ b/spec/unit/node/attribute_spec.rb @@ -518,7 +518,7 @@ describe Chef::Node::Attribute do describe "dup" do it "array can be duped even if some elements can't" do - @attributes.default[:foo] = %w[foo bar baz] + Array(1..3) + [nil, true, false, [ "el", 0, nil ] ] + @attributes.default[:foo] = %w{foo bar baz} + Array(1..3) + [nil, true, false, [ "el", 0, nil ] ] @attributes.default[:foo].dup end end diff --git a/spec/unit/node/immutable_collections_spec.rb b/spec/unit/node/immutable_collections_spec.rb index 07176beb76..097680b179 100644 --- a/spec/unit/node/immutable_collections_spec.rb +++ b/spec/unit/node/immutable_collections_spec.rb @@ -22,7 +22,7 @@ require "chef/node/immutable_collections" describe Chef::Node::ImmutableMash do before do @data_in = {:top => {:second_level => "some value"}, - "top_level_2" => %w[array of values], + "top_level_2" => %w{array of values}, :top_level_3 => [{:hash_array => 1, :hash_array_b => 2}], :top_level_4 => {:level2 => {:key => "value"}}, } @@ -34,7 +34,7 @@ describe Chef::Node::ImmutableMash do end it "element references like a regular Mash" do - expect(@immutable_mash[:top_level_2]).to eq(%w[array of values]) + expect(@immutable_mash[:top_level_2]).to eq(%w{array of values}) end it "converts Hash-like inputs into ImmutableMash's" do @@ -112,7 +112,7 @@ end describe Chef::Node::ImmutableArray do before do - @immutable_array = Chef::Node::ImmutableArray.new(%w[foo bar baz] + Array(1..3) + [nil, true, false, [ "el", 0, nil ] ]) + @immutable_array = Chef::Node::ImmutableArray.new(%w{foo bar baz} + Array(1..3) + [nil, true, false, [ "el", 0, nil ] ]) immutable_mash = Chef::Node::ImmutableMash.new({:m => "m"}) @immutable_nested_array = Chef::Node::ImmutableArray.new(["level1",@immutable_array, immutable_mash]) end diff --git a/spec/unit/provider/package/rpm_spec.rb b/spec/unit/provider/package/rpm_spec.rb index 409b5268ee..d994f463b7 100644 --- a/spec/unit/provider/package/rpm_spec.rb +++ b/spec/unit/provider/package/rpm_spec.rb @@ -287,7 +287,7 @@ describe Chef::Provider::Package::Rpm do provider.process_resource_requirements end - %w(http HTTP https HTTPS ftp FTP file FILE).each do |scheme| + %w{http HTTP https HTTPS ftp FTP file FILE}.each do |scheme| context "when the source URI uses protocol scheme '#{scheme}'" do diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb index efbbdf6450..fc248122c9 100644 --- a/spec/unit/provider/package/yum_spec.rb +++ b/spec/unit/provider/package/yum_spec.rb @@ -2179,7 +2179,7 @@ describe "Chef::Provider::Package::Yum - Multi" do it "should set package_version if no existing package_name is found and new_package_name is available" do @new_resource = Chef::Resource::Package.new(["cups = 1.2.4-11.18.el5_2.3", "emacs = 24.4"]) @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context) - allow(@yum_cache).to receive(:package_available?) { |pkg| %w(cups emacs).include?(pkg) ? true : false } + allow(@yum_cache).to receive(:package_available?) { |pkg| %w{cups emacs}.include?(pkg) ? true : false } allow(@yum_cache).to receive(:candidate_version) do |pkg| if pkg == "cups" "1.2.4-11.18.el5_2.3" diff --git a/spec/unit/provider/route_spec.rb b/spec/unit/provider/route_spec.rb index 0205df430c..1832445667 100644 --- a/spec/unit/provider/route_spec.rb +++ b/spec/unit/provider/route_spec.rb @@ -211,7 +211,7 @@ describe Chef::Provider::Route do end describe Chef::Provider::Route, "generate_config method" do - %w[ centos redhat fedora ].each do |platform| + %w{ centos redhat fedora }.each do |platform| it "should write a route file on #{platform} platform" do @node.automatic_attrs[:platform] = platform diff --git a/spec/unit/provider_resolver_spec.rb b/spec/unit/provider_resolver_spec.rb index 16befad5ca..cae2f96799 100644 --- a/spec/unit/provider_resolver_spec.rb +++ b/spec/unit/provider_resolver_spec.rb @@ -480,7 +480,7 @@ describe Chef::ProviderResolver do end end - on_platform %w(freebsd netbsd), platform_version: "3.1.4" do + on_platform %w{freebsd netbsd}, platform_version: "3.1.4" do it "returns a Freebsd provider if it finds the /usr/local/etc/rc.d initscript" do stub_service_providers stub_service_configs(:usr_local_etc_rcd) @@ -648,7 +648,7 @@ describe Chef::ProviderResolver do "suse" => { "12.0" => { }, - %w(11.1 11.2 11.3) => { + %w{11.1 11.2 11.3} => { group: [ Chef::Resource::Group, Chef::Provider::Group::Suse ] }, }, @@ -681,12 +681,12 @@ describe Chef::ProviderResolver do package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ], ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig::Redhat ], - %w(amazon xcp xenserver ibm_powerkvm cloudlinux parallels) => { + %w{amazon xcp xenserver ibm_powerkvm cloudlinux parallels} => { "3.1.4" => { # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ], } }, - %w(redhat centos scientific oracle) => { + %w{redhat centos scientific oracle} => { "7.0" => { }, "6.0" => { @@ -705,7 +705,7 @@ describe Chef::ProviderResolver do }, "darwin" => { - %w(mac_os_x mac_os_x_server) => { + %w{mac_os_x mac_os_x_server} => { group: [ Chef::Resource::Group, Chef::Provider::Group::Dscl ], package: [ Chef::Resource::HomebrewPackage, Chef::Provider::Package::Homebrew ], osx_profile: [ Chef::Resource::OsxProfile, Chef::Provider::OsxProfile], @@ -732,7 +732,7 @@ describe Chef::ProviderResolver do windows_service: [ Chef::Resource::WindowsService, Chef::Provider::Service::Windows ], "windows" => { - %w(mswin mingw32 windows) => { + %w{mswin mingw32 windows} => { "10.9.2" => { } } diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb index d247a1bb5e..6b96115cfc 100644 --- a/spec/unit/recipe_spec.rb +++ b/spec/unit/recipe_spec.rb @@ -367,7 +367,7 @@ describe Chef::Recipe do it "gives a sane error message when using method_missing" do expect do recipe.no_such_resource("foo") - end.to raise_error(NoMethodError, %q[No resource or method named `no_such_resource' for `Chef::Recipe "test"']) + end.to raise_error(NoMethodError, %q{No resource or method named `no_such_resource' for `Chef::Recipe "test"'}) end it "gives a sane error message when using method_missing 'bare'" do @@ -376,7 +376,7 @@ describe Chef::Recipe do # Giving an argument will change this from NameError to NoMethodError no_such_resource end - end.to raise_error(NameError, %q[No resource, method, or local variable named `no_such_resource' for `Chef::Recipe "test"']) + end.to raise_error(NameError, %q{No resource, method, or local variable named `no_such_resource' for `Chef::Recipe "test"'}) end it "gives a sane error message when using build_resource" do diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 53d546d059..0994837622 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -417,7 +417,7 @@ describe Chef::Resource do describe "is" do it "should return the arguments passed with 'is'" do zm = Chef::Resource::ZenMaster.new("coffee") - expect(zm.is("one", "two", "three")).to eq(%w|one two three|) + expect(zm.is("one", "two", "three")).to eq(%w{one two three}) end it "should allow arguments preceded by is to methods" do diff --git a/spec/unit/rest_spec.rb b/spec/unit/rest_spec.rb index ba5f837c07..8e6a3be79c 100644 --- a/spec/unit/rest_spec.rb +++ b/spec/unit/rest_spec.rb @@ -430,7 +430,7 @@ describe Chef::REST do end end - %w[ HTTPFound HTTPMovedPermanently HTTPSeeOther HTTPUseProxy HTTPTemporaryRedirect HTTPMultipleChoice ].each do |resp_name| + %w{ HTTPFound HTTPMovedPermanently HTTPSeeOther HTTPUseProxy HTTPTemporaryRedirect HTTPMultipleChoice }.each do |resp_name| describe "when encountering a #{resp_name} redirect" do let(:http_response) do resp_cls = Net.const_get(resp_name) diff --git a/spec/unit/run_list/versioned_recipe_list_spec.rb b/spec/unit/run_list/versioned_recipe_list_spec.rb index e1927f8310..a52c1818df 100644 --- a/spec/unit/run_list/versioned_recipe_list_spec.rb +++ b/spec/unit/run_list/versioned_recipe_list_spec.rb @@ -39,7 +39,7 @@ describe Chef::RunList::VersionedRecipeList do describe "add_recipe" do - let(:recipes) { %w[ apt god apache2 ] } + let(:recipes) { %w{ apt god apache2 } } it "should append the recipe to the end of the list" do list.add_recipe "rails" @@ -130,20 +130,20 @@ describe Chef::RunList::VersionedRecipeList do context "with bare cookbook names" do - let(:recipes) { %w[ apache2 ] } + let(:recipes) { %w{ apache2 } } it "gives $cookbook_name::default" do - expect(fq_names).to eq( %w[ apache2::default ] ) + expect(fq_names).to eq( %w{ apache2::default } ) end end context "with qualified recipe names but no versions" do - let(:recipes) { %w[ mysql::server ] } + let(:recipes) { %w{ mysql::server } } it "returns the qualified recipe names" do - expect(fq_names).to eq( %w[ mysql::server ] ) + expect(fq_names).to eq( %w{ mysql::server } ) end end diff --git a/spec/unit/version/platform_spec.rb b/spec/unit/version/platform_spec.rb index 6c9720fe6d..5a6c9fde0e 100644 --- a/spec/unit/version/platform_spec.rb +++ b/spec/unit/version/platform_spec.rb @@ -30,7 +30,7 @@ describe Chef::Version::Platform do end describe "when creating valid Versions" do - good_versions = %w(1 1.2 1.2.3 1000.80.50000 0.300.25 001.02.00003 1.2-STABLE 10.0-BETA3 9.1-RELEASE-p3) + good_versions = %w{1 1.2 1.2.3 1000.80.50000 0.300.25 001.02.00003 1.2-STABLE 10.0-BETA3 9.1-RELEASE-p3} good_versions.each do |v| it "should accept '#{v}'" do Chef::Version::Platform.new v diff --git a/spec/unit/version_class_spec.rb b/spec/unit/version_class_spec.rb index 2e70b7e00c..2e66931607 100644 --- a/spec/unit/version_class_spec.rb +++ b/spec/unit/version_class_spec.rb @@ -44,7 +44,7 @@ describe Chef::Version do end describe "when creating valid Versions" do - good_versions = %w(1.2 1.2.3 1000.80.50000 0.300.25 001.02.00003) + good_versions = %w{1.2 1.2.3 1000.80.50000 0.300.25 001.02.00003} good_versions.each do |v| it "should accept '#{v}'" do Chef::Version.new v |