summaryrefslogtreecommitdiff
path: root/spec/integration/knife/list_spec.rb
diff options
context:
space:
mode:
authorjkeiser <jkeiser@opscode.com>2012-12-31 13:45:45 -0800
committerJohn Keiser <jkeiser@opscode.com>2013-06-07 13:12:14 -0700
commit788faf68cc5e81245f9563ce6e183a1aa7ae058a (patch)
tree01cf24f1c4f81bd82e322fda6d2e430cb3921b54 /spec/integration/knife/list_spec.rb
parent4ba14e2929c0bb1c59ebc35e5b8bf542e9c8c72a (diff)
downloadchef-788faf68cc5e81245f9563ce6e183a1aa7ae058a.tar.gz
Add --local tests, repository file/dir DSL
Diffstat (limited to 'spec/integration/knife/list_spec.rb')
-rw-r--r--spec/integration/knife/list_spec.rb65
1 files changed, 65 insertions, 0 deletions
diff --git a/spec/integration/knife/list_spec.rb b/spec/integration/knife/list_spec.rb
index 598d697386..faee19e61a 100644
--- a/spec/integration/knife/list_spec.rb
+++ b/spec/integration/knife/list_spec.rb
@@ -188,4 +188,69 @@ role2.json
"
end
end
+
+ context "--local" do
+ when_the_repository "is empty" do
+ it "knife list --local / returns nothing" do
+ knife('list', '--local', '/').stdout.should == ""
+ end
+
+ it "knife list /roles returns nothing" do
+ knife('list', '--local', '/roles').stdout.should == ""
+ end
+ end
+
+ when_the_repository "has a bunch of stuff" do
+ directory 'clients' do
+ file 'client1.json', {}
+ file 'client2.json', {}
+ end
+ directory 'cookbooks' do
+ directory 'cookbook1' do
+ file 'metadata.rb', ''
+ end
+ directory 'cookbook2' do
+ file 'metadata.rb', ''
+ file 'recipes/default.rb', ''
+ end
+ end
+ file 'data_bags/bag1/item1.json', {}
+ file 'data_bags/bag1/item2.json', {}
+ file 'data_bags/bag2/item1.json', {}
+ file 'data_bags/bag2/item2.json', {}
+ file 'environments/environment1.json', {}
+ file 'environments/environment2.json', {}
+ file 'nodes/node1.json', {}
+ file 'nodes/node2.json', {}
+ file 'roles/role1.json', {}
+ file 'roles/role2.json', {}
+ file 'users/user1.json', {}
+ file 'users/user2.json', {}
+
+ it "knife list -Rp --flat / returns everything" do
+ knife('list', '-Rp', '--flat', '/').stdout.should == "/cookbooks/
+/cookbooks/cookbook1/
+/cookbooks/cookbook1/metadata.rb
+/cookbooks/cookbook2/
+/cookbooks/cookbook2/metadata.rb
+/cookbooks/cookbook2/recipes/
+/cookbooks/cookbook2/recipes/default.rb
+/data_bags/
+/data_bags/bag1/
+/data_bags/bag1/item1.json
+/data_bags/bag1/item2.json
+/data_bags/bag2/
+/data_bags/bag2/item1.json
+/data_bags/bag2/item2.json
+/environments/
+/environments/_default.json
+/environments/environment1.json
+/environments/environment2.json
+/roles/
+/roles/role1.json
+/roles/role2.json
+"
+ end
+ end
+ end
end