diff options
author | Nate Walck <nate.walck@gmail.com> | 2015-10-05 16:07:02 -0700 |
---|---|---|
committer | Nate Walck <nate.walck@gmail.com> | 2015-12-17 08:21:26 -0500 |
commit | e05e7b485463ea2c9346a83ad1bbc095cc95d4df (patch) | |
tree | 4deb5d987e59ec0854e6ce72c50b88d205e2e84f /spec/unit/resource | |
parent | 4b0531742b7e560d04a2fda7bcc24d6da9ea1c60 (diff) | |
download | chef-e05e7b485463ea2c9346a83ad1bbc095cc95d4df.tar.gz |
Added profile provider for OS X
Fixed resource to use let
Diffstat (limited to 'spec/unit/resource')
-rw-r--r-- | spec/unit/resource/osx_profile_spec.rb | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/spec/unit/resource/osx_profile_spec.rb b/spec/unit/resource/osx_profile_spec.rb new file mode 100644 index 0000000000..d7d72e5836 --- /dev/null +++ b/spec/unit/resource/osx_profile_spec.rb @@ -0,0 +1,61 @@ +# +# Author:: Nate Walck (<nate.walck@gmail.com>) +# Copyright:: Copyright (c) 2015 Facebook, 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::OsxProfile do + let(:resource) { Chef::Resource::OsxProfile.new( + "Test Profile Resource", + run_context) + } + + it "should create a new Chef::Resource::OsxProfile" do + expect(resource).to be_a_kind_of(Chef::Resource) + expect(resource).to be_a_kind_of(Chef::Resource::OsxProfile) + end + + it "should have a resource name of profile" do + expect(resource.resource_name).to eql(:osx_profile) + end + + it "should have a default action of install" do + expect(resource.action).to eql([:install]) + end + + it "should accept install and remove as actions" do + expect { resource.action :install}.not_to raise_error + expect { resource.action :remove}.not_to raise_error + end + + it "should allow you to set the profile attribute" do + resource.profile "com.testprofile.screensaver" + expect(resource.profile).to eql("com.testprofile.screensaver") + end + + it "should allow you to set the profile attribute to a string" do + resource.profile "com.testprofile.screensaver" + expect(resource.profile).to be_a(String) + expect(resource.profile).to eql("com.testprofile.screensaver") + end + + it "should allow you to set the profile attribute to a hash" do + test_profile = { 'profile' => false } + resource.profile test_profile + expect(resource.profile).to be_a(Hash) + end +end |