summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-07-03 12:26:05 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-07-05 12:40:44 -0700
commit4978a9a8a402477f3b35f43404701d6a5cf26fa1 (patch)
tree7f336c1fa29d7bdb50f8a6e0a2e5943fbb32ba51 /spec
parent2833651dcf54db5ba8e92746b479ebafa897b275 (diff)
downloadchef-4978a9a8a402477f3b35f43404701d6a5cf26fa1.tar.gz
Style/EmptyLiteral
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/functional/dsl/reboot_pending_spec.rb2
-rw-r--r--spec/functional/knife/ssh_spec.rb2
-rw-r--r--spec/support/shared/unit/platform_introspector.rb2
-rw-r--r--spec/support/shared/unit/windows_script_resource.rb2
-rw-r--r--spec/unit/api_client_spec.rb10
-rw-r--r--spec/unit/api_client_v1_spec.rb12
-rw-r--r--spec/unit/chef_fs/config_spec.rb6
-rw-r--r--spec/unit/cookbook_loader_spec.rb10
-rw-r--r--spec/unit/data_bag_item_spec.rb2
-rw-r--r--spec/unit/data_bag_spec.rb2
-rw-r--r--spec/unit/dsl/data_query_spec.rb2
-rw-r--r--spec/unit/environment_spec.rb16
-rw-r--r--spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb2
-rw-r--r--spec/unit/http/authenticator_spec.rb2
-rw-r--r--spec/unit/key_spec.rb2
-rw-r--r--spec/unit/knife/client_bulk_delete_spec.rb4
-rw-r--r--spec/unit/knife/cookbook_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/key_create_spec.rb2
-rw-r--r--spec/unit/knife/key_edit_spec.rb2
-rw-r--r--spec/unit/knife/key_list_spec.rb2
-rw-r--r--spec/unit/knife/node_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/role_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/supermarket_install_spec.rb2
-rw-r--r--spec/unit/mixin/params_validate_spec.rb6
-rw-r--r--spec/unit/mixin/windows_architecture_helper_spec.rb2
-rw-r--r--spec/unit/node/attribute_spec.rb14
-rw-r--r--spec/unit/node_spec.rb10
-rw-r--r--spec/unit/org_spec.rb6
-rw-r--r--spec/unit/provider/powershell_script_spec.rb2
-rw-r--r--spec/unit/resource/batch_spec.rb2
-rw-r--r--spec/unit/resource/directory_spec.rb2
-rw-r--r--spec/unit/resource/file_spec.rb2
-rw-r--r--spec/unit/resource/link_spec.rb2
-rw-r--r--spec/unit/resource/powershell_script_spec.rb2
-rw-r--r--spec/unit/resource/windows_env_spec.rb2
-rw-r--r--spec/unit/resource_collection/resource_set_spec.rb2
-rw-r--r--spec/unit/resource_collection_spec.rb6
-rw-r--r--spec/unit/resource_definition_spec.rb2
-rw-r--r--spec/unit/role_spec.rb4
-rw-r--r--spec/unit/run_list_spec.rb2
-rw-r--r--spec/unit/search/query_spec.rb2
-rw-r--r--spec/unit/user_spec.rb8
-rw-r--r--spec/unit/user_v1_spec.rb6
-rw-r--r--spec/unit/util/editor_spec.rb2
44 files changed, 89 insertions, 89 deletions
diff --git a/spec/functional/dsl/reboot_pending_spec.rb b/spec/functional/dsl/reboot_pending_spec.rb
index 855a38b9cf..89701802b3 100644
--- a/spec/functional/dsl/reboot_pending_spec.rb
+++ b/spec/functional/dsl/reboot_pending_spec.rb
@@ -36,7 +36,7 @@ describe Chef::DSL::RebootPending, :windows_only do
let(:reg_key) { nil }
let(:original_set) { false }
- before(:all) { @any_flag = Hash.new }
+ before(:all) { @any_flag = {} }
after { @any_flag[reg_key] = original_set }
diff --git a/spec/functional/knife/ssh_spec.rb b/spec/functional/knife/ssh_spec.rb
index 95e7b6454c..929c4dc693 100644
--- a/spec/functional/knife/ssh_spec.rb
+++ b/spec/functional/knife/ssh_spec.rb
@@ -31,7 +31,7 @@ describe Chef::Knife::Ssh do
@server.stop
end
- let(:ssh_config) { Hash.new }
+ let(:ssh_config) { {} }
before do
allow(Net::SSH).to receive(:configuration_for).and_return(ssh_config)
end
diff --git a/spec/support/shared/unit/platform_introspector.rb b/spec/support/shared/unit/platform_introspector.rb
index 0354c3a33c..3b07fdd367 100644
--- a/spec/support/shared/unit/platform_introspector.rb
+++ b/spec/support/shared/unit/platform_introspector.rb
@@ -43,7 +43,7 @@ shared_examples_for "a platform introspector" do
end
it "returns a default value when there is no known platform" do
- node = Hash.new
+ node = {}
expect(platform_introspector.value_for_platform(@platform_hash)).to eq("default")
end
diff --git a/spec/support/shared/unit/windows_script_resource.rb b/spec/support/shared/unit/windows_script_resource.rb
index 5b559bb83b..29238a3917 100644
--- a/spec/support/shared/unit/windows_script_resource.rb
+++ b/spec/support/shared/unit/windows_script_resource.rb
@@ -25,7 +25,7 @@ shared_examples_for "a Windows script resource" do
before(:each) do
node = Chef::Node.new
- node.default["kernel"] = Hash.new
+ node.default["kernel"] = {}
node.default["kernel"][:machine] = :x86_64.to_s
run_context = Chef::RunContext.new(node, nil, nil)
diff --git a/spec/unit/api_client_spec.rb b/spec/unit/api_client_spec.rb
index e6b2eec820..f36cbc721d 100644
--- a/spec/unit/api_client_spec.rb
+++ b/spec/unit/api_client_spec.rb
@@ -41,7 +41,7 @@ describe Chef::ApiClient do
end
it "only allows string values for the name" do
- expect { @client.name Hash.new }.to raise_error(ArgumentError)
+ expect { @client.name({}) }.to raise_error(ArgumentError)
end
it "has an admin flag attribute" do
@@ -55,7 +55,7 @@ describe Chef::ApiClient do
it "allows only boolean values for the admin flag" do
expect { @client.admin(false) }.not_to raise_error
- expect { @client.admin(Hash.new) }.to raise_error(ArgumentError)
+ expect { @client.admin({}) }.to raise_error(ArgumentError)
end
it "has a 'validator' flag attribute" do
@@ -69,7 +69,7 @@ describe Chef::ApiClient do
it "allows only boolean values for the 'validator' flag" do
expect { @client.validator(false) }.not_to raise_error
- expect { @client.validator(Hash.new) }.to raise_error(ArgumentError)
+ expect { @client.validator({}) }.to raise_error(ArgumentError)
end
it "has a public key attribute" do
@@ -79,7 +79,7 @@ describe Chef::ApiClient do
it "accepts only String values for the public key" do
expect { @client.public_key "" }.not_to raise_error
- expect { @client.public_key Hash.new }.to raise_error(ArgumentError)
+ expect { @client.public_key({}) }.to raise_error(ArgumentError)
end
it "has a private key attribute" do
@@ -89,7 +89,7 @@ describe Chef::ApiClient do
it "accepts only String values for the private key" do
expect { @client.private_key "" }.not_to raise_error
- expect { @client.private_key Hash.new }.to raise_error(ArgumentError)
+ expect { @client.private_key({}) }.to raise_error(ArgumentError)
end
describe "when serializing to JSON" do
diff --git a/spec/unit/api_client_v1_spec.rb b/spec/unit/api_client_v1_spec.rb
index 6c4e7fe188..3bad466a13 100644
--- a/spec/unit/api_client_v1_spec.rb
+++ b/spec/unit/api_client_v1_spec.rb
@@ -36,7 +36,7 @@ describe Chef::ApiClientV1 do
end
it "only allows string values for the name" do
- expect { @client.name Hash.new }.to raise_error(ArgumentError)
+ expect { @client.name({}) }.to raise_error(ArgumentError)
end
it "has an admin flag attribute" do
@@ -50,7 +50,7 @@ describe Chef::ApiClientV1 do
it "allows only boolean values for the admin flag" do
expect { @client.admin(false) }.not_to raise_error
- expect { @client.admin(Hash.new) }.to raise_error(ArgumentError)
+ expect { @client.admin({}) }.to raise_error(ArgumentError)
end
it "has an create_key flag attribute" do
@@ -64,7 +64,7 @@ describe Chef::ApiClientV1 do
it "allows only boolean values for the create_key flag" do
expect { @client.create_key(false) }.not_to raise_error
- expect { @client.create_key(Hash.new) }.to raise_error(ArgumentError)
+ expect { @client.create_key({}) }.to raise_error(ArgumentError)
end
it "has a 'validator' flag attribute" do
@@ -78,7 +78,7 @@ describe Chef::ApiClientV1 do
it "allows only boolean values for the 'validator' flag" do
expect { @client.validator(false) }.not_to raise_error
- expect { @client.validator(Hash.new) }.to raise_error(ArgumentError)
+ expect { @client.validator({}) }.to raise_error(ArgumentError)
end
it "has a public key attribute" do
@@ -88,7 +88,7 @@ describe Chef::ApiClientV1 do
it "accepts only String values for the public key" do
expect { @client.public_key "" }.not_to raise_error
- expect { @client.public_key Hash.new }.to raise_error(ArgumentError)
+ expect { @client.public_key({}) }.to raise_error(ArgumentError)
end
it "has a private key attribute" do
@@ -98,7 +98,7 @@ describe Chef::ApiClientV1 do
it "accepts only String values for the private key" do
expect { @client.private_key "" }.not_to raise_error
- expect { @client.private_key Hash.new }.to raise_error(ArgumentError)
+ expect { @client.private_key({}) }.to raise_error(ArgumentError)
end
describe "when serializing to JSON" do
diff --git a/spec/unit/chef_fs/config_spec.rb b/spec/unit/chef_fs/config_spec.rb
index f552d454d0..bdb9bc2c72 100644
--- a/spec/unit/chef_fs/config_spec.rb
+++ b/spec/unit/chef_fs/config_spec.rb
@@ -23,7 +23,7 @@ require "lib/chef/chef_fs/config.rb"
describe Chef::ChefFS::Config do
describe "initialize" do
it "warns when hosted setups use 'everything'" do
- base_config = Hash.new
+ base_config = {}
base_config[:repo_mode] = "everything"
base_config[:chef_server_url] = "http://foo.com/organizations/fake_org/"
@@ -34,7 +34,7 @@ describe Chef::ChefFS::Config do
end
it "doesn't warn when hosted setups use 'hosted_everything'" do
- base_config = Hash.new
+ base_config = {}
base_config[:repo_mode] = "hosted_everything"
base_config[:chef_server_url] = "http://foo.com/organizations/fake_org/"
@@ -45,7 +45,7 @@ describe Chef::ChefFS::Config do
end
it "doesn't warn when non-hosted setups use 'everything'" do
- base_config = Hash.new
+ base_config = {}
base_config[:repo_mode] = "everything"
base_config[:chef_server_url] = "http://foo.com/"
diff --git a/spec/unit/cookbook_loader_spec.rb b/spec/unit/cookbook_loader_spec.rb
index 9180f13f33..ba9f59c97b 100644
--- a/spec/unit/cookbook_loader_spec.rb
+++ b/spec/unit/cookbook_loader_spec.rb
@@ -88,7 +88,7 @@ describe Chef::CookbookLoader do
describe "each" do
it "should allow you to iterate over cookbooks with each" do
- seen = Hash.new
+ seen = {}
cookbook_loader.each_key do |cookbook_name|
seen[cookbook_name] = true
end
@@ -97,7 +97,7 @@ describe Chef::CookbookLoader do
end
it "should iterate in alphabetical order" do
- seen = Array.new
+ seen = []
cookbook_loader.each_key do |cookbook_name|
seen << cookbook_name
end
@@ -173,7 +173,7 @@ describe Chef::CookbookLoader do
end
it "should have loaded the correct cookbook" do
- seen = Hash.new
+ seen = {}
cookbook_loader.each_key do |cookbook_name|
seen[cookbook_name] = true
end
@@ -203,7 +203,7 @@ describe Chef::CookbookLoader do
end
it "should not load the other cookbooks" do
- seen = Hash.new
+ seen = {}
cookbook_loader.each_key do |cookbook_name|
seen[cookbook_name] = true
end
@@ -239,7 +239,7 @@ describe Chef::CookbookLoader do
end
it "should load all cookbooks" do
- seen = Hash.new
+ seen = {}
cookbook_loader.each_key do |cookbook_name|
seen[cookbook_name] = true
end
diff --git a/spec/unit/data_bag_item_spec.rb b/spec/unit/data_bag_item_spec.rb
index 3c3420a55a..78953c6b6f 100644
--- a/spec/unit/data_bag_item_spec.rb
+++ b/spec/unit/data_bag_item_spec.rb
@@ -43,7 +43,7 @@ describe Chef::DataBagItem do
end
it "should throw an ArgumentError if you feed it anything but a string" do
- expect { data_bag_item.data_bag Hash.new }.to raise_error(ArgumentError)
+ expect { data_bag_item.data_bag({}) }.to raise_error(ArgumentError)
end
end
diff --git a/spec/unit/data_bag_spec.rb b/spec/unit/data_bag_spec.rb
index 388c35232f..4b0ba42172 100644
--- a/spec/unit/data_bag_spec.rb
+++ b/spec/unit/data_bag_spec.rb
@@ -46,7 +46,7 @@ describe Chef::DataBag do
end
it "should throw an ArgumentError if you feed it anything but a string" do
- expect { @data_bag.name Hash.new }.to raise_error(ArgumentError)
+ expect { @data_bag.name({}) }.to raise_error(ArgumentError)
end
[ ".", "-", "_", "1"].each do |char|
diff --git a/spec/unit/dsl/data_query_spec.rb b/spec/unit/dsl/data_query_spec.rb
index f93f07bc52..00a1f47fcf 100644
--- a/spec/unit/dsl/data_query_spec.rb
+++ b/spec/unit/dsl/data_query_spec.rb
@@ -24,7 +24,7 @@ class DataQueryDSLTester
end
describe Chef::DSL::DataQuery do
- let(:node) { Hash.new }
+ let(:node) { {} }
let(:language) do
language = DataQueryDSLTester.new
diff --git a/spec/unit/environment_spec.rb b/spec/unit/environment_spec.rb
index 4da3a9fa0e..42906ef772 100644
--- a/spec/unit/environment_spec.rb
+++ b/spec/unit/environment_spec.rb
@@ -48,8 +48,8 @@ describe Chef::Environment do
end
it "should not accept anything but strings" do
- expect { @environment.name(Array.new) }.to raise_error(ArgumentError)
- expect { @environment.name(Hash.new) }.to raise_error(ArgumentError)
+ expect { @environment.name([]) }.to raise_error(ArgumentError)
+ expect { @environment.name({}) }.to raise_error(ArgumentError)
expect { @environment.name(2) }.to raise_error(ArgumentError)
end
end
@@ -65,8 +65,8 @@ describe Chef::Environment do
end
it "should not accept anything but strings" do
- expect { @environment.description(Array.new) }.to raise_error(ArgumentError)
- expect { @environment.description(Hash.new) }.to raise_error(ArgumentError)
+ expect { @environment.description([]) }.to raise_error(ArgumentError)
+ expect { @environment.description({}) }.to raise_error(ArgumentError)
expect { @environment.description(42) }.to raise_error(ArgumentError)
end
end
@@ -82,7 +82,7 @@ describe Chef::Environment do
end
it "should throw an ArgumentError if we aren't a kind of hash" do
- expect { @environment.default_attributes(Array.new) }.to raise_error(ArgumentError)
+ expect { @environment.default_attributes([]) }.to raise_error(ArgumentError)
end
end
@@ -97,7 +97,7 @@ describe Chef::Environment do
end
it "should throw an ArgumentError if we aren't a kind of hash" do
- expect { @environment.override_attributes(Array.new) }.to raise_error(ArgumentError)
+ expect { @environment.override_attributes([]) }.to raise_error(ArgumentError)
end
end
@@ -121,7 +121,7 @@ describe Chef::Environment do
it "should not accept anything but a hash" do
expect { @environment.cookbook_versions("I am a string!") }.to raise_error(ArgumentError)
- expect { @environment.cookbook_versions(Array.new) }.to raise_error(ArgumentError)
+ expect { @environment.cookbook_versions([]) }.to raise_error(ArgumentError)
expect { @environment.cookbook_versions(42) }.to raise_error(ArgumentError)
end
@@ -257,7 +257,7 @@ describe Chef::Environment do
end
it "should return false if anything other than a hash is passed as the argument" do
- expect(Chef::Environment.validate_cookbook_versions(Array.new)).to eq(false)
+ expect(Chef::Environment.validate_cookbook_versions([])).to eq(false)
expect(Chef::Environment.validate_cookbook_versions(42)).to eq(false)
expect(Chef::Environment.validate_cookbook_versions(Chef::CookbookVersion.new("meta"))).to eq(false)
expect(Chef::Environment.validate_cookbook_versions("cookbook => 1.2.3")).to eq(false)
diff --git a/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb b/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb
index b2ca8704b0..6d7f31c6f1 100644
--- a/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb
+++ b/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb
@@ -22,7 +22,7 @@ describe Chef::GuardInterpreter::ResourceGuardInterpreter do
let(:node) do
node = Chef::Node.new
- node.default["kernel"] = Hash.new
+ node.default["kernel"] = {}
node.default["kernel"][:machine] = :x86_64.to_s
node.automatic[:os] = "windows"
node
diff --git a/spec/unit/http/authenticator_spec.rb b/spec/unit/http/authenticator_spec.rb
index a2d4cb4815..89fff82f04 100644
--- a/spec/unit/http/authenticator_spec.rb
+++ b/spec/unit/http/authenticator_spec.rb
@@ -23,7 +23,7 @@ describe Chef::HTTP::Authenticator do
let(:class_instance) { Chef::HTTP::Authenticator.new(client_name: "test") }
let(:method) { "GET" }
let(:url) { URI("https://chef.example.com/organizations/test") }
- let(:headers) { Hash.new }
+ let(:headers) { {} }
let(:data) { "" }
context "when handle_request is called" do
diff --git a/spec/unit/key_spec.rb b/spec/unit/key_spec.rb
index e3d9f8e7ad..efae549490 100644
--- a/spec/unit/key_spec.rb
+++ b/spec/unit/key_spec.rb
@@ -66,7 +66,7 @@ describe Chef::Key do
context "when you feed it anything but a string" do
it "should raise an ArgumentError" do
- expect { key.send(field, Hash.new) }.to raise_error(ArgumentError)
+ expect { key.send(field, {}) }.to raise_error(ArgumentError)
end
end
end
diff --git a/spec/unit/knife/client_bulk_delete_spec.rb b/spec/unit/knife/client_bulk_delete_spec.rb
index 21bac9d0c0..770ba8762f 100644
--- a/spec/unit/knife/client_bulk_delete_spec.rb
+++ b/spec/unit/knife/client_bulk_delete_spec.rb
@@ -42,7 +42,7 @@ describe Chef::Knife::ClientBulkDelete do
let(:nonvalidator_client_names) { %w{tim dan stephen} }
let(:nonvalidator_clients) do
- clients = Hash.new
+ clients = {}
nonvalidator_client_names.each do |client_name|
client = Chef::ApiClientV1.new
@@ -56,7 +56,7 @@ describe Chef::Knife::ClientBulkDelete do
let(:validator_client_names) { %w{myorg-validator} }
let(:validator_clients) do
- clients = Hash.new
+ clients = {}
validator_client_names.each do |validator_client_name|
validator_client = Chef::ApiClientV1.new
diff --git a/spec/unit/knife/cookbook_bulk_delete_spec.rb b/spec/unit/knife/cookbook_bulk_delete_spec.rb
index c8c1873081..d01213227b 100644
--- a/spec/unit/knife/cookbook_bulk_delete_spec.rb
+++ b/spec/unit/knife/cookbook_bulk_delete_spec.rb
@@ -31,7 +31,7 @@ describe Chef::Knife::CookbookBulkDelete do
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
allow(@knife.ui).to receive(:stderr).and_return(@stderr)
allow(@knife.ui).to receive(:confirm).and_return(true)
- @cookbooks = Hash.new
+ @cookbooks = {}
%w{cheezburger pizza lasagna}.each do |cookbook_name|
cookbook = Chef::CookbookVersion.new(cookbook_name)
@cookbooks[cookbook_name] = cookbook
diff --git a/spec/unit/knife/key_create_spec.rb b/spec/unit/knife/key_create_spec.rb
index fcbfd40381..6437ba2bcd 100644
--- a/spec/unit/knife/key_create_spec.rb
+++ b/spec/unit/knife/key_create_spec.rb
@@ -84,7 +84,7 @@ Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
0wIDAQAB
-----END PUBLIC KEY-----"
end
- let(:config) { Hash.new }
+ let(:config) { {} }
let(:actor) { "charmander" }
let(:ui) { instance_double("Chef::Knife::UI") }
diff --git a/spec/unit/knife/key_edit_spec.rb b/spec/unit/knife/key_edit_spec.rb
index 7c409f5ea0..1f8067c160 100644
--- a/spec/unit/knife/key_edit_spec.rb
+++ b/spec/unit/knife/key_edit_spec.rb
@@ -86,7 +86,7 @@ Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo
0wIDAQAB
-----END PUBLIC KEY-----"
end
- let(:config) { Hash.new }
+ let(:config) { {} }
let(:actor) { "charmander" }
let(:keyname) { "charmander-key" }
let(:ui) { instance_double("Chef::Knife::UI") }
diff --git a/spec/unit/knife/key_list_spec.rb b/spec/unit/knife/key_list_spec.rb
index e221a4da72..c65a11b08c 100644
--- a/spec/unit/knife/key_list_spec.rb
+++ b/spec/unit/knife/key_list_spec.rb
@@ -73,7 +73,7 @@ describe "key list commands that inherit knife" do
end
describe Chef::Knife::KeyList do
- let(:config) { Hash.new }
+ let(:config) { {} }
let(:actor) { "charmander" }
let(:ui) { instance_double("Chef::Knife::UI") }
diff --git a/spec/unit/knife/node_bulk_delete_spec.rb b/spec/unit/knife/node_bulk_delete_spec.rb
index b955b5de6c..b97df004a3 100644
--- a/spec/unit/knife/node_bulk_delete_spec.rb
+++ b/spec/unit/knife/node_bulk_delete_spec.rb
@@ -28,7 +28,7 @@ describe Chef::Knife::NodeBulkDelete do
@stdout = StringIO.new
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
allow(@knife.ui).to receive(:confirm).and_return(true)
- @nodes = Hash.new
+ @nodes = {}
%w{adam brent jacob}.each do |node_name|
@nodes[node_name] = "http://localhost:4000/nodes/#{node_name}"
end
diff --git a/spec/unit/knife/role_bulk_delete_spec.rb b/spec/unit/knife/role_bulk_delete_spec.rb
index c39a8ec652..07a9b484c4 100644
--- a/spec/unit/knife/role_bulk_delete_spec.rb
+++ b/spec/unit/knife/role_bulk_delete_spec.rb
@@ -29,7 +29,7 @@ describe Chef::Knife::RoleBulkDelete do
@stdout = StringIO.new
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
allow(@knife.ui).to receive(:confirm).and_return(true)
- @roles = Hash.new
+ @roles = {}
%w{dev staging production}.each do |role_name|
role = Chef::Role.new
role.name(role_name)
diff --git a/spec/unit/knife/supermarket_install_spec.rb b/spec/unit/knife/supermarket_install_spec.rb
index d891de9268..801fb74802 100644
--- a/spec/unit/knife/supermarket_install_spec.rb
+++ b/spec/unit/knife/supermarket_install_spec.rb
@@ -23,7 +23,7 @@ describe Chef::Knife::SupermarketInstall do
let(:knife) { Chef::Knife::SupermarketInstall.new }
let(:stdout) { StringIO.new }
let(:stderr) { StringIO.new }
- let(:downloader) { Hash.new }
+ let(:downloader) { {} }
let(:archive) { double(Mixlib::Archive, extract: true) }
let(:repo) do
double(sanity_check: true, reset_to_default_state: true,
diff --git a/spec/unit/mixin/params_validate_spec.rb b/spec/unit/mixin/params_validate_spec.rb
index 5f29095bcb..489742cb7d 100644
--- a/spec/unit/mixin/params_validate_spec.rb
+++ b/spec/unit/mixin/params_validate_spec.rb
@@ -44,7 +44,7 @@ describe Chef::Mixin::ParamsValidate do
it "should require validation map keys to be symbols or strings" do
expect { @vo.validate({ one: "two" }, { one: true }) }.not_to raise_error
expect { @vo.validate({ one: "two" }, { "one" => true }) }.not_to raise_error
- expect { @vo.validate({ one: "two" }, { Hash.new => true }) }.to raise_error(ArgumentError)
+ expect { @vo.validate({ one: "two" }, { {} => true }) }.to raise_error(ArgumentError)
end
it "should allow options to be required with true" do
@@ -163,7 +163,7 @@ describe Chef::Mixin::ParamsValidate do
end
it "should let you set a default value with default => value" do
- arguments = Hash.new
+ arguments = {}
@vo.validate(arguments, {
one: {
default: "is the loneliest number",
@@ -321,7 +321,7 @@ describe Chef::Mixin::ParamsValidate do
end.not_to raise_error
expect do
@vo.validate(
- { one: Hash.new },
+ { one: {} },
{
one: {
kind_of: [ String, Array ],
diff --git a/spec/unit/mixin/windows_architecture_helper_spec.rb b/spec/unit/mixin/windows_architecture_helper_spec.rb
index 06acbe49c9..7d4e18d23c 100644
--- a/spec/unit/mixin/windows_architecture_helper_spec.rb
+++ b/spec/unit/mixin/windows_architecture_helper_spec.rb
@@ -74,7 +74,7 @@ describe Chef::Mixin::WindowsArchitectureHelper do
def with_node_architecture_combinations
@valid_architectures.each do |node_architecture|
new_node = Chef::Node.new
- new_node.default["kernel"] = Hash.new
+ new_node.default["kernel"] = {}
new_node.default["kernel"][:machine] = node_architecture.to_s
@valid_architectures.each do |architecture|
diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb
index 1b9a9841e5..5055941d06 100644
--- a/spec/unit/node/attribute_spec.rb
+++ b/spec/unit/node/attribute_spec.rb
@@ -589,7 +589,7 @@ describe Chef::Node::Attribute do
end
it "should yield each top level key" do
- collect = Array.new
+ collect = []
@attributes.each_key do |k|
collect << k
end
@@ -602,7 +602,7 @@ describe Chef::Node::Attribute do
end
it "should yield lower if we go deeper" do
- collect = Array.new
+ collect = []
@attributes["one"].each_key do |k|
collect << k
end
@@ -637,7 +637,7 @@ describe Chef::Node::Attribute do
end
it "should yield each top level key and value, post merge rules" do
- collect = Hash.new
+ collect = {}
@attributes.each do |k, v|
collect[k] = v
end
@@ -679,7 +679,7 @@ describe Chef::Node::Attribute do
end
it "should yield each top level key, post merge rules" do
- collect = Array.new
+ collect = []
@attributes.each_key do |k|
collect << k
end
@@ -715,7 +715,7 @@ describe Chef::Node::Attribute do
end
it "should yield each top level key and value pair, post merge rules" do
- collect = Hash.new
+ collect = {}
@attributes.each_pair do |k, v|
collect[k] = v
end
@@ -751,7 +751,7 @@ describe Chef::Node::Attribute do
end
it "should yield each value, post merge rules" do
- collect = Array.new
+ collect = []
@attributes.each_value do |v|
collect << v
end
@@ -762,7 +762,7 @@ describe Chef::Node::Attribute do
end
it "should yield four elements" do
- collect = Array.new
+ collect = []
@attributes.each_value do |v|
collect << v
end
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb
index c071e82fae..0fe375a4df 100644
--- a/spec/unit/node_spec.rb
+++ b/spec/unit/node_spec.rb
@@ -103,7 +103,7 @@ describe Chef::Node do
end
it "should always have a string for name" do
- expect { node.name(Hash.new) }.to raise_error(ArgumentError)
+ expect { node.name({}) }.to raise_error(ArgumentError)
end
it "cannot be blank" do
@@ -126,7 +126,7 @@ describe Chef::Node do
end
it "should disallow non-strings" do
- expect { node.chef_environment(Hash.new) }.to raise_error(ArgumentError)
+ expect { node.chef_environment({}) }.to raise_error(ArgumentError)
expect { node.chef_environment(42) }.to raise_error(ArgumentError)
end
@@ -162,7 +162,7 @@ describe Chef::Node do
end
it "disallows non-strings" do
- expect { node.policy_name(Hash.new) }.to raise_error(Chef::Exceptions::ValidationFailed)
+ expect { node.policy_name({}) }.to raise_error(Chef::Exceptions::ValidationFailed)
expect { node.policy_name(42) }.to raise_error(Chef::Exceptions::ValidationFailed)
end
@@ -198,7 +198,7 @@ describe Chef::Node do
end
it "disallows non-strings" do
- expect { node.policy_group(Hash.new) }.to raise_error(Chef::Exceptions::ValidationFailed)
+ expect { node.policy_group({}) }.to raise_error(Chef::Exceptions::ValidationFailed)
expect { node.policy_group(42) }.to raise_error(Chef::Exceptions::ValidationFailed)
end
@@ -793,7 +793,7 @@ describe Chef::Node do
it "should allow you to iterate over attributes with each_attribute" do
node.default["sunshine"] = "is bright"
node.default["canada"] = "is a nice place"
- seen_attributes = Hash.new
+ seen_attributes = {}
node.each_attribute do |a, v|
seen_attributes[a] = v
end
diff --git a/spec/unit/org_spec.rb b/spec/unit/org_spec.rb
index 79a29b1fff..b291b7cb86 100644
--- a/spec/unit/org_spec.rb
+++ b/spec/unit/org_spec.rb
@@ -52,7 +52,7 @@ describe Chef::Org do
end
it "raises an ArgumentError if you feed it anything but a string" do
- expect { org.name Hash.new }.to raise_error(ArgumentError)
+ expect { org.name({}) }.to raise_error(ArgumentError)
end
end
@@ -63,7 +63,7 @@ describe Chef::Org do
end
it "raises an ArgumentError if you feed it anything but a string" do
- expect { org.name Hash.new }.to raise_error(ArgumentError)
+ expect { org.name({}) }.to raise_error(ArgumentError)
end
end
@@ -74,7 +74,7 @@ describe Chef::Org do
end
it "raises an ArgumentError if you feed it something lame" do
- expect { org.private_key Hash.new }.to raise_error(ArgumentError)
+ expect { org.private_key({}) }.to raise_error(ArgumentError)
end
end
diff --git a/spec/unit/provider/powershell_script_spec.rb b/spec/unit/provider/powershell_script_spec.rb
index a247c26651..be4df761d2 100644
--- a/spec/unit/provider/powershell_script_spec.rb
+++ b/spec/unit/provider/powershell_script_spec.rb
@@ -22,7 +22,7 @@ describe Chef::Provider::PowershellScript, "action_run" do
let(:powershell_version) { nil }
let(:node) do
node = Chef::Node.new
- node.default["kernel"] = Hash.new
+ node.default["kernel"] = {}
node.default["kernel"][:machine] = :x86_64.to_s
if ! powershell_version.nil?
node.default[:languages] = { powershell: { version: powershell_version } }
diff --git a/spec/unit/resource/batch_spec.rb b/spec/unit/resource/batch_spec.rb
index c161428a13..dd3082100e 100644
--- a/spec/unit/resource/batch_spec.rb
+++ b/spec/unit/resource/batch_spec.rb
@@ -22,7 +22,7 @@ describe Chef::Resource::Batch do
let(:node) { Chef::Node.new }
before(:each) do
- node.default["kernel"] = Hash.new
+ node.default["kernel"] = {}
node.default["kernel"][:machine] = :x86_64.to_s
node.automatic[:os] = "windows"
diff --git a/spec/unit/resource/directory_spec.rb b/spec/unit/resource/directory_spec.rb
index 3dd68211db..0c0c0d8287 100644
--- a/spec/unit/resource/directory_spec.rb
+++ b/spec/unit/resource/directory_spec.rb
@@ -38,7 +38,7 @@ describe Chef::Resource::Directory do
it "accepts a string as the path" do
expect { resource.path "/tmp" }.not_to raise_error
expect(resource.path).to eql("/tmp")
- expect { resource.path Hash.new }.to raise_error(ArgumentError)
+ expect { resource.path({}) }.to raise_error(ArgumentError)
end
it "allows you to have specify whether the action is recursive with true/false" do
diff --git a/spec/unit/resource/file_spec.rb b/spec/unit/resource/file_spec.rb
index 54dc8ab92b..b49fc4564b 100644
--- a/spec/unit/resource/file_spec.rb
+++ b/spec/unit/resource/file_spec.rb
@@ -85,7 +85,7 @@ describe Chef::Resource::File do
it "accepts a string as the path" do
expect { resource.path "/tmp" }.not_to raise_error
expect(resource.path).to eql("/tmp")
- expect { resource.path Hash.new }.to raise_error(ArgumentError)
+ expect { resource.path({}) }.to raise_error(ArgumentError)
end
describe "when it has a path, owner, group, mode, and checksum" do
diff --git a/spec/unit/resource/link_spec.rb b/spec/unit/resource/link_spec.rb
index 05a39835d8..ae32e4aa30 100644
--- a/spec/unit/resource/link_spec.rb
+++ b/spec/unit/resource/link_spec.rb
@@ -63,7 +63,7 @@ describe Chef::Resource::Link do
end
it "does not accept a Hash for the link source via 'to'" do
- expect { resource.to Hash.new }.to raise_error(ArgumentError)
+ expect { resource.to({}) }.to raise_error(ArgumentError)
end
it "allows you to set a link source via 'to'" do
diff --git a/spec/unit/resource/powershell_script_spec.rb b/spec/unit/resource/powershell_script_spec.rb
index a1c5e4c5b0..34d530c1a2 100644
--- a/spec/unit/resource/powershell_script_spec.rb
+++ b/spec/unit/resource/powershell_script_spec.rb
@@ -23,7 +23,7 @@ describe Chef::Resource::PowershellScript do
before(:each) do
node = Chef::Node.new
- node.default["kernel"] = Hash.new
+ node.default["kernel"] = {}
node.default["kernel"][:machine] = :x86_64.to_s
node.automatic[:os] = "windows"
diff --git a/spec/unit/resource/windows_env_spec.rb b/spec/unit/resource/windows_env_spec.rb
index 06b5af630a..3ba5b18881 100644
--- a/spec/unit/resource/windows_env_spec.rb
+++ b/spec/unit/resource/windows_env_spec.rb
@@ -47,7 +47,7 @@ describe Chef::Resource::WindowsEnv do
end
it "does not accept a Hash for the env value via 'to'" do
- expect { resource.value Hash.new }.to raise_error(ArgumentError)
+ expect { resource.value({}) }.to raise_error(ArgumentError)
end
it "allows you to set an env value via 'to'" do
diff --git a/spec/unit/resource_collection/resource_set_spec.rb b/spec/unit/resource_collection/resource_set_spec.rb
index 60053d2b71..30a55cd3e1 100644
--- a/spec/unit/resource_collection/resource_set_spec.rb
+++ b/spec/unit/resource_collection/resource_set_spec.rb
@@ -172,7 +172,7 @@ describe Chef::ResourceCollection::ResourceSet do
end
it "should raise an exception if you pass something other than a string or hash to resource" do
- expect { collection.find([Array.new]) }.to raise_error(ArgumentError)
+ expect { collection.find([[]]) }.to raise_error(ArgumentError)
end
it "raises an error when attempting to find a resource that does not exist" do
diff --git a/spec/unit/resource_collection_spec.rb b/spec/unit/resource_collection_spec.rb
index a26616d454..60f17b6934 100644
--- a/spec/unit/resource_collection_spec.rb
+++ b/spec/unit/resource_collection_spec.rb
@@ -97,7 +97,7 @@ describe Chef::ResourceCollection do
describe "each" do
it "should allow you to iterate over every resource in the collection" do
load_up_resources
- results = Array.new
+ results = []
expect do
rc.each do |r|
results << r.name
@@ -119,7 +119,7 @@ describe Chef::ResourceCollection do
describe "each_index" do
it "should allow you to iterate over every resource by index" do
load_up_resources
- results = Array.new
+ results = []
expect do
rc.each_index do |i|
results << rc[i].name
@@ -246,7 +246,7 @@ describe Chef::ResourceCollection do
end
it "should raise an exception if you pass something other than a string or hash to resource" do
- expect { rc.resources([Array.new]) }.to raise_error(ArgumentError)
+ expect { rc.resources([[]]) }.to raise_error(ArgumentError)
end
it "raises an error when attempting to find a resource that does not exist" do
diff --git a/spec/unit/resource_definition_spec.rb b/spec/unit/resource_definition_spec.rb
index 2e3fc63260..a1c59eaaca 100644
--- a/spec/unit/resource_definition_spec.rb
+++ b/spec/unit/resource_definition_spec.rb
@@ -92,7 +92,7 @@ describe Chef::ResourceDefinition do
it "should raise an exception if prototype_params is not a hash" do
expect do
- defn.define :monkey, Array.new do
+ defn.define :monkey, [] do
end
end.to raise_error(ArgumentError)
end
diff --git a/spec/unit/role_spec.rb b/spec/unit/role_spec.rb
index 46ee71bb1c..13932ab3ee 100644
--- a/spec/unit/role_spec.rb
+++ b/spec/unit/role_spec.rb
@@ -113,7 +113,7 @@ describe Chef::Role do
end
it "should throw an ArgumentError if we aren't a kind of hash" do
- expect { @role.default_attributes(Array.new) }.to raise_error(ArgumentError)
+ expect { @role.default_attributes([]) }.to raise_error(ArgumentError)
end
end
@@ -128,7 +128,7 @@ describe Chef::Role do
end
it "should throw an ArgumentError if we aren't a kind of hash" do
- expect { @role.override_attributes(Array.new) }.to raise_error(ArgumentError)
+ expect { @role.override_attributes([]) }.to raise_error(ArgumentError)
end
end
diff --git a/spec/unit/run_list_spec.rb b/spec/unit/run_list_spec.rb
index ac062c665d..5dc877ad9a 100644
--- a/spec/unit/run_list_spec.rb
+++ b/spec/unit/run_list_spec.rb
@@ -133,7 +133,7 @@ describe Chef::RunList do
it "should yield each member to your block" do
@run_list << "foo"
@run_list << "bar"
- seen = Array.new
+ seen = []
@run_list.each { |r| seen << r }
expect(seen).to be_include("recipe[foo]")
expect(seen).to be_include("recipe[bar]")
diff --git a/spec/unit/search/query_spec.rb b/spec/unit/search/query_spec.rb
index 151fcb51b3..641e8558ad 100644
--- a/spec/unit/search/query_spec.rb
+++ b/spec/unit/search/query_spec.rb
@@ -169,7 +169,7 @@ describe Chef::Search::Query do
it "accepts a type as the first argument" do
expect { query.search("node") }.not_to raise_error
expect { query.search(:node) }.not_to raise_error
- expect { query.search(Hash.new) }.to raise_error(Chef::Exceptions::InvalidSearchQuery, /(Hash)/)
+ expect { query.search({}) }.to raise_error(Chef::Exceptions::InvalidSearchQuery, /(Hash)/)
end
it "queries for every object of a type by default" do
diff --git a/spec/unit/user_spec.rb b/spec/unit/user_spec.rb
index 48dbf010e9..492dc147d9 100644
--- a/spec/unit/user_spec.rb
+++ b/spec/unit/user_spec.rb
@@ -65,7 +65,7 @@ describe Chef::User do
end
it "should throw an ArgumentError if you feed it anything but a string" do
- expect { @user.name Hash.new }.to raise_error(ArgumentError)
+ expect { @user.name({}) }.to raise_error(ArgumentError)
end
end
@@ -84,7 +84,7 @@ describe Chef::User do
end
it "should throw an ArgumentError if you feed it anything but true or false" do
- expect { @user.name Hash.new }.to raise_error(ArgumentError)
+ expect { @user.name({}) }.to raise_error(ArgumentError)
end
end
@@ -99,7 +99,7 @@ describe Chef::User do
end
it "should throw an ArgumentError if you feed it something lame" do
- expect { @user.public_key Hash.new }.to raise_error(ArgumentError)
+ expect { @user.public_key({}) }.to raise_error(ArgumentError)
end
end
@@ -114,7 +114,7 @@ describe Chef::User do
end
it "should throw an ArgumentError if you feed it something lame" do
- expect { @user.private_key Hash.new }.to raise_error(ArgumentError)
+ expect { @user.private_key({}) }.to raise_error(ArgumentError)
end
end
diff --git a/spec/unit/user_v1_spec.rb b/spec/unit/user_v1_spec.rb
index 37b2252492..4bde7278fe 100644
--- a/spec/unit/user_v1_spec.rb
+++ b/spec/unit/user_v1_spec.rb
@@ -37,7 +37,7 @@ describe Chef::UserV1 do
end
it "should throw an ArgumentError if you feed it something lame" do
- expect { @user.send(method, Hash.new) }.to raise_error(ArgumentError)
+ expect { @user.send(method, {}) }.to raise_error(ArgumentError)
end
end
@@ -57,7 +57,7 @@ describe Chef::UserV1 do
end
it "should throw an ArgumentError if you feed it anything but true or false" do
- expect { @user.send(method, Hash.new) }.to raise_error(ArgumentError)
+ expect { @user.send(method, {}) }.to raise_error(ArgumentError)
end
end
@@ -95,7 +95,7 @@ describe Chef::UserV1 do
end
it "should throw an ArgumentError if you feed it anything but a string" do
- expect { @user.username Hash.new }.to raise_error(ArgumentError)
+ expect { @user.username({}) }.to raise_error(ArgumentError)
end
end
diff --git a/spec/unit/util/editor_spec.rb b/spec/unit/util/editor_spec.rb
index e53bc9662a..ac851a835e 100644
--- a/spec/unit/util/editor_spec.rb
+++ b/spec/unit/util/editor_spec.rb
@@ -9,7 +9,7 @@ describe Chef::Util::Editor do
end
it "makes a copy of an Array" do
- array = Array.new
+ array = []
editor = described_class.new(array)
expect(editor.lines).to_not be(array)
end