summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-02-19 09:30:17 -0800
committerGitHub <noreply@github.com>2018-02-19 09:30:17 -0800
commit9a2ba654492fd53f05f3f363badbebb26f7bf70f (patch)
tree744f8ca2d1c01baeb2a371eff61e6b30201e5174 /spec
parentab46256c6119dd5a2394e424c2b20dcd1f3ccd47 (diff)
parente8f01e79670b43e9fa49955156de33154c741d2c (diff)
downloadchef-9a2ba654492fd53f05f3f363badbebb26f7bf70f.tar.gz
Merge pull request #6795 from chef/hostname_resource
Add hostname resource from chef_hostname cookbook
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/resource/hostname_spec.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/unit/resource/hostname_spec.rb b/spec/unit/resource/hostname_spec.rb
new file mode 100644
index 0000000000..33f944dbc9
--- /dev/null
+++ b/spec/unit/resource/hostname_spec.rb
@@ -0,0 +1,43 @@
+#
+# Copyright:: Copyright 2018, Chef Software, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require "spec_helper"
+
+describe Chef::Resource::Hostname do
+
+ let(:resource) { Chef::Resource::Hostname.new("foo") }
+
+ it "has a resource name of :hostname" do
+ expect(resource.resource_name).to eql(:hostname)
+ end
+
+ it "has a default action of set" do
+ expect(resource.action).to eql([:set])
+ end
+
+ it "runs at compile_time by default" do
+ expect(resource.compile_time).to eql(true)
+ end
+
+ it "reboots windows nodes by default" do
+ expect(resource.windows_reboot).to eql(true)
+ end
+
+ it "the hostname property is the name property" do
+ expect(resource.hostname).to eql("foo")
+ end
+end