From 70f7314af9bd65d7752773cd492e68963750e2fe Mon Sep 17 00:00:00 2001 From: Steven Danna Date: Tue, 2 Dec 2014 12:27:14 +0000 Subject: Make name argument mandatory for Chef::Org.new --- lib/chef/org.rb | 5 ++--- spec/unit/org_spec.rb | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/chef/org.rb b/lib/chef/org.rb index 9a4f7d93ac..2868b36952 100644 --- a/lib/chef/org.rb +++ b/lib/chef/org.rb @@ -7,7 +7,7 @@ class Chef include Chef::Mixin::ParamsValidate - def initialize(name='') + def initialize(name) @name = name @full_name = '' # The Chef API returns the private key of the validator @@ -95,8 +95,7 @@ class Chef # Class methods def self.from_hash(org_hash) - org = Chef::Org.new - org.name org_hash['name'] + org = Chef::Org.new(org_hash['name']) org.full_name org_hash['full_name'] org.private_key org_hash['private_key'] if org_hash.key?('private_key') org.guid org_hash['guid'] if org_hash.key?('guid') diff --git a/spec/unit/org_spec.rb b/spec/unit/org_spec.rb index 81d9bda020..1ba0492dd8 100644 --- a/spec/unit/org_spec.rb +++ b/spec/unit/org_spec.rb @@ -23,7 +23,7 @@ require 'tempfile' describe Chef::Org do before(:each) do - @org = Chef::Org.new + @org = Chef::Org.new("an_org") end describe "initialize" do @@ -139,8 +139,7 @@ describe Chef::Org do Chef::Config[:chef_server_root] = "http://www.example.com" @rest = double('rest') allow(Chef::REST).to receive(:new).and_return(@rest) - @org = Chef::Org.new - @org.name "foobar" + @org = Chef::Org.new("foobar") @org.full_name "foo bar bat" end -- cgit v1.2.1