summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Danna <steve@opscode.com>2014-12-02 12:27:14 +0000
committerLamont Granquist <lamont@scriptkiddie.org>2015-01-25 14:06:52 -0800
commit70f7314af9bd65d7752773cd492e68963750e2fe (patch)
tree9313a41f7022fc1fe9e73a5fe9f8d01f4a9c30f5
parent73b76328d81f43575eeca5bf8574f0644cfab710 (diff)
downloadchef-70f7314af9bd65d7752773cd492e68963750e2fe.tar.gz
Make name argument mandatory for Chef::Org.new
-rw-r--r--lib/chef/org.rb5
-rw-r--r--spec/unit/org_spec.rb5
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