diff options
author | Derek Groh <derekgroh@gmail.com> | 2018-08-21 15:13:00 -0500 |
---|---|---|
committer | Derek Groh <derekgroh@gmail.com> | 2018-08-21 15:13:12 -0500 |
commit | 9a3171bd1cfbed9500b3625b6b31f74ccbcf9359 (patch) | |
tree | 437ac69cc2e3c644a99c1fb59730e209e2a0167d | |
parent | b552b6f17fbb377bbd8c54cdb285a8a23ef541e5 (diff) | |
download | chef-9a3171bd1cfbed9500b3625b6b31f74ccbcf9359.tar.gz |
unit tests for windows_workgroup resource
Signed-off-by: Derek Groh <derekgroh@github.io>
-rw-r--r-- | spec/unit/resource/windows_workgroup_spec.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/unit/resource/windows_workgroup_spec.rb b/spec/unit/resource/windows_workgroup_spec.rb new file mode 100644 index 0000000000..3d7acec2fb --- /dev/null +++ b/spec/unit/resource/windows_workgroup_spec.rb @@ -0,0 +1,47 @@ +# +# 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::WindowsWorkgroup do + let(:resource) { Chef::Resource::WindowsWorkgroup.new("example") } + + it "sets resource name as :windows_workgroup" do + expect(resource.resource_name).to eql(:windows_workgroup) + end + + it "the workgroup_name property is the name_property" do + expect(resource.workgroup_name).to eql("example") + end + + it "sets the default action as :join" do + expect(resource.action).to eql([:join]) + end + + it "supports :join action" do + expect { resource.action :join }.not_to raise_error + end + + it "accepts :immediate, :reboot_now, :request_reboot, :delayed, or :never values for 'reboot' property" do + expect { resource.reboot :immediate }.not_to raise_error + expect { resource.reboot :delayed }.not_to raise_error + expect { resource.reboot :reboot_now }.not_to raise_error + expect { resource.reboot :request_reboot }.not_to raise_error + expect { resource.reboot :never }.not_to raise_error + expect { resource.reboot :nopenope }.to raise_error(ArgumentError) + end +end |