summaryrefslogtreecommitdiff
path: root/spec/unit/resource
diff options
context:
space:
mode:
authorAdam Jacob <adam@hjksolutions.com>2008-03-06 22:13:01 -0800
committerAdam Jacob <adam@hjksolutions.com>2008-03-06 22:13:01 -0800
commitaca232ba638afdc45f6d5b3e9b3f68d4a149d0a5 (patch)
tree63dd4c3b55ebd5ca95c5ec16a751d48c36c84a04 /spec/unit/resource
parentb5117775e86cff40399187b6292c98fba9dc5034 (diff)
downloadchef-aca232ba638afdc45f6d5b3e9b3f68d4a149d0a5.tar.gz
Marionette does graphs, and can eval on the fly to resources
Diffstat (limited to 'spec/unit/resource')
-rw-r--r--spec/unit/resource/file_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/unit/resource/file_spec.rb b/spec/unit/resource/file_spec.rb
index 14641e79cd..633805b56c 100644
--- a/spec/unit/resource/file_spec.rb
+++ b/spec/unit/resource/file_spec.rb
@@ -55,4 +55,37 @@ describe Marionette::Resource::File do
lambda { @resource.checksum = "blues" }.should raise_error(ArgumentError)
end
+ it "should accept absent or present for ensure" do
+ lambda { @resource.ensure = "absent" }.should_not raise_error(ArgumentError)
+ lambda { @resource.ensure = "present" }.should_not raise_error(ArgumentError)
+ lambda { @resource.ensure = "blues" }.should raise_error(ArgumentError)
+ end
+
+ it "should accept a group name or id for group" do
+ lambda { @resource.group = "root" }.should_not raise_error(ArgumentError)
+ lambda { @resource.group = 123 }.should_not raise_error(ArgumentError)
+ lambda { @resource.group = "root*goo" }.should raise_error(ArgumentError)
+ end
+
+ it "should accept a valid unix file mode" do
+ lambda { @resource.mode = 0444 }.should_not raise_error(ArgumentError)
+ lambda { @resource.mode = 444 }.should_not raise_error(ArgumentError)
+ lambda { @resource.mode = 4 }.should raise_error(ArgumentError)
+ end
+
+ it "should accept a user name or id for owner" do
+ lambda { @resource.owner = "root" }.should_not raise_error(ArgumentError)
+ lambda { @resource.owner = 123 }.should_not raise_error(ArgumentError)
+ lambda { @resource.owner = "root*goo" }.should raise_error(ArgumentError)
+ end
+
+ it "should use the object name as the path by default" do
+ @resource.path.should eql("fakey_fakerton")
+ end
+
+ it "should accept a string as the path" do
+ lambda { @resource.path = "/tmp" }.should_not raise_error(ArgumentError)
+ lambda { @resource.path = Hash.new }.should raise_error(ArgumentError)
+ end
+
end \ No newline at end of file