diff options
| author | Luke Kanies <luke@madstop.com> | 2007-08-26 12:58:39 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-08-26 12:58:39 -0500 |
| commit | 51ff72c42447e5b9e05db3b24530a4e628454396 (patch) | |
| tree | 8e7618942fd6a0c7ada1edbe7527becb9325f224 | |
| parent | 4e9c63181f4c3912e48ddd97782f07b89826d9fd (diff) | |
| download | puppet-51ff72c42447e5b9e05db3b24530a4e628454396.tar.gz puppet-51ff72c42447e5b9e05db3b24530a4e628454396.tar.xz puppet-51ff72c42447e5b9e05db3b24530a4e628454396.zip | |
Adding a bit of testing for node names.
| -rw-r--r-- | lib/puppet/node.rb | 10 | ||||
| -rwxr-xr-x | spec/unit/other/node.rb | 5 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb index e23472ebf..2d3ac712e 100644 --- a/lib/puppet/node.rb +++ b/lib/puppet/node.rb @@ -24,7 +24,15 @@ class Puppet::Node @name = name # Provide a default value. - @names = [name] + if names = options[:names] + if names.is_a?(String) + @names = [names] + else + @names = names + end + else + @names = [name] + end if classes = options[:classes] if classes.is_a?(String) diff --git a/spec/unit/other/node.rb b/spec/unit/other/node.rb index a29fb23cf..66d5ba9d7 100755 --- a/spec/unit/other/node.rb +++ b/spec/unit/other/node.rb @@ -44,6 +44,11 @@ describe Puppet::Node, " when initializing" do @node = Puppet::Node.new("testing", :environment => "myenv") @node.environment.should == "myenv" end + + it "should accept names passed in" do + @node = Puppet::Node.new("testing", :names => ["myenv"]) + @node.names.should == ["myenv"] + end end describe Puppet::Node, " when returning the environment" do |
