diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 10:25:16 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 10:25:16 -0700 |
commit | 35603c7ce1bd3ccf35334ed65152140f0ecaf080 (patch) | |
tree | 452c84ce196ce00d672c71a8fa65f86c5a074fac /spec/unit/node_spec.rb | |
parent | eda2808dce8146bfdb308dd658b1dd565df3562b (diff) | |
download | chef-35603c7ce1bd3ccf35334ed65152140f0ecaf080.tar.gz |
fix Style/HashSyntax
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/unit/node_spec.rb')
-rw-r--r-- | spec/unit/node_spec.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index 3a43a155d5..ee0f969f6d 100644 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -52,7 +52,7 @@ describe Chef::Node do describe "when the node does not exist on the server" do before do - response = OpenStruct.new(:code => "404") + response = OpenStruct.new(code: "404") exception = Net::HTTPServerException.new("404 not found", response) allow(Chef::Node).to receive(:load).and_raise(exception) node.name("created-node") @@ -852,7 +852,7 @@ describe Chef::Node do describe "consuming json" do before do - @ohai_data = { :platform => "foo", :platform_version => "bar" } + @ohai_data = { platform: "foo", platform_version: "bar" } end it "consumes the run list portion of a collection of attributes and returns the remainder" do @@ -944,7 +944,7 @@ describe Chef::Node do describe "preparing for a chef client run" do before do - @ohai_data = { :platform => "foobuntu", :platform_version => "23.42" } + @ohai_data = { platform: "foobuntu", platform_version: "23.42" } end it "sets its platform according to platform detection" do @@ -1096,12 +1096,12 @@ describe Chef::Node do before do node.chef_environment = "rspec" @expansion = Chef::RunList::RunListExpansion.new("rspec", []) - @expansion.default_attrs.replace({ :default => "from role", :d_role => "role only" }) - @expansion.override_attrs.replace({ :override => "from role", :o_role => "role only" }) + @expansion.default_attrs.replace({ default: "from role", d_role: "role only" }) + @expansion.override_attrs.replace({ override: "from role", o_role: "role only" }) @environment = Chef::Environment.new - @environment.default_attributes = { :default => "from env", :d_env => "env only" } - @environment.override_attributes = { :override => "from env", :o_env => "env only" } + @environment.default_attributes = { default: "from env", d_env: "env only" } + @environment.override_attributes = { override: "from env", o_env: "env only" } allow(Chef::Environment).to receive(:load).and_return(@environment) node.apply_expansion_attributes(@expansion) end @@ -1269,7 +1269,7 @@ describe Chef::Node do end describe "converting to or from json" do - it "should serialize itself as json", :json => true do + it "should serialize itself as json", json: true do node.from_file(File.expand_path("nodes/test.example.com.rb", CHEF_SPEC_DATA)) json = Chef::JSONCompat.to_json(node) expect(json).to match(/json_class/) @@ -1281,7 +1281,7 @@ describe Chef::Node do expect(json).to match(/run_list/) end - it "should serialize valid json with a run list", :json => true do + it "should serialize valid json with a run list", json: true do #This test came about because activesupport mucks with Chef json serialization #Test should pass with and without Activesupport node.run_list << { "type" => "role", "name" => "Cthulu" } @@ -1290,7 +1290,7 @@ describe Chef::Node do expect(json).to match(/\"run_list\":\[\"role\[Cthulu\]\",\"role\[Hastur\]\"\]/) end - it "should serialize the correct run list", :json => true do + it "should serialize the correct run list", json: true do node.run_list << "role[marxist]" node.run_list << "role[leninist]" node.override_runlist << "role[stalinist]" @@ -1315,7 +1315,7 @@ describe Chef::Node do expect(node_for_json["default"]["env default"]).to eq("env default") end - it "should deserialize itself from json", :json => true do + it "should deserialize itself from json", json: true do node.from_file(File.expand_path("nodes/test.example.com.rb", CHEF_SPEC_DATA)) json = Chef::JSONCompat.to_json(node) serialized_node = Chef::Node.from_hash(Chef::JSONCompat.parse(json)) @@ -1392,7 +1392,7 @@ describe Chef::Node do describe "list" do describe "inflated" do it "should return a hash of node names and objects" do - n1 = double("Chef::Node", :name => "one") + n1 = double("Chef::Node", name: "one") allow(n1).to receive(:kind_of?).with(Chef::Node) { true } expect(@query).to receive(:search).with(:node).and_yield(n1) r = Chef::Node.list(true) @@ -1446,7 +1446,7 @@ describe Chef::Node do it "should create if it cannot update" do node.name("monkey") allow(node).to receive(:data_for_save).and_return({}) - exception = double("404 error", :code => "404") + exception = double("404 error", code: "404") expect(@rest).to receive(:put).and_raise(Net::HTTPServerException.new("foo", exception)) expect(@rest).to receive(:post).with("nodes", {}) node.save |