summaryrefslogtreecommitdiff
path: root/spec/unit/resource/remote_directory_spec.rb
blob: 2d9ce122af67793f742db1126c5586325a2bd156 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#
# Author:: Adam Jacob (<adam@hjksolutions.com>)
# Copyright:: Copyright (c) 2008 HJK Solutions, LLC
# 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 File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))

describe Chef::Resource::RemoteDirectory do

  before(:each) do
    @resource = Chef::Resource::RemoteDirectory.new("/etc/dunk")
  end  

  it "should create a new Chef::Resource::RemoteDirectory" do
    @resource.should be_a_kind_of(Chef::Resource)
    @resource.should be_a_kind_of(Chef::Resource::RemoteDirectory)
  end

  it "should set the path to the first argument to new" do
    @resource.path.should eql("/etc/dunk")
  end

  it "should accept a string for the remote directory source" do
    @resource.source "foo"
    @resource.source.should eql("foo")
  end

  it "should accept a number for the remote files backup" do
    @resource.files_backup 1
    @resource.files_backup.should eql(1)
  end
  
  it "should accept false for the remote files backup" do
    @resource.files_backup false
    @resource.files_backup.should eql(false)
  end
  
  it "should accept 3 or 4 digets for the files_mode" do
    @resource.files_mode 100
    @resource.files_mode.should eql(100)
    @resource.files_mode 1000
    @resource.files_mode.should eql(1000)
  end
  
  it "should accept a string or number for the files group" do
    @resource.files_group "heart"
    @resource.files_group.should eql("heart")
    @resource.files_group 1000
    @resource.files_group.should eql(1000)
  end
  
  it "should accept a string or number for the files owner" do
    @resource.files_owner "heart"
    @resource.files_owner.should eql("heart")
    @resource.files_owner 1000
    @resource.files_owner.should eql(1000)
  end
end