diff options
author | danielsdeleo <dan@opscode.com> | 2012-12-10 16:05:54 -0800 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-01-03 16:26:26 -0800 |
commit | 8be5dcbfa21315ba97204e498d02e42cf2ccde2e (patch) | |
tree | 61672ece37ab41f8299b4d07698e469c14daea91 /spec/unit/provider/template_spec.rb | |
parent | b5f34643733d23bab6495c9952e068515343c766 (diff) | |
download | chef-8be5dcbfa21315ba97204e498d02e42cf2ccde2e.tar.gz |
[CHEF-3557] remove load_current_resource_attrs
Functionality was a duplicate of ScanAccessControl with some slightly
different behavior. Correct behavior is now implemented in
ScanAccessControl.
Diffstat (limited to 'spec/unit/provider/template_spec.rb')
-rw-r--r-- | spec/unit/provider/template_spec.rb | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/spec/unit/provider/template_spec.rb b/spec/unit/provider/template_spec.rb index f5d30f0219..5f59f8d50e 100644 --- a/spec/unit/provider/template_spec.rb +++ b/spec/unit/provider/template_spec.rb @@ -47,16 +47,16 @@ describe Chef::Provider::Template do else Struct::Passwd.new("root", "x", 0, 0, "root", "/root", "/bin/bash") end - group_struct = OpenStruct.new(:name => "root", :passwd => "x", :gid => 0) + group_struct = mock("Group Ent", :name => "root", :passwd => "x", :gid => 0) Etc.stub!(:getpwuid).and_return(passwd_struct) Etc.stub!(:getgrgid).and_return(group_struct) end describe "when creating the template" do - before do - + before do end + after do FileUtils.rm(@rendered_file_location) if ::File.exist?(@rendered_file_location) end @@ -115,6 +115,23 @@ describe Chef::Provider::Template do IO.read(@rendered_file_location).should == "slappiness is happiness" @resource.should be_updated_by_last_action end + + context "and no access control settings are set on the resource" do + it "sets access control metadata on the new resource" do + @access_controls.stub!(:requires_changes?).and_return(false) + @access_controls.should_receive(:set_all!) + @node.normal[:slappiness] = "happiness" + @provider.should_receive(:backup) + @provider.run_action(:create) + IO.read(@rendered_file_location).should == "slappiness is happiness" + @resource.should be_updated_by_last_action + + # Veracity of actual data checked in functional tests + @resource.owner.should be_a_kind_of(String) + @resource.group.should be_a_kind_of(String) + @resource.mode.should be_a_kind_of(String) + end + end end describe "when the target file has the wrong content" do |