# # Author:: John Keiser () # Copyright:: Copyright (c) 2013 Opscode, 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 'support/shared/integration/integration_helper' require 'chef/knife/list' describe 'knife list' do extend IntegrationSupport include KnifeSupport when_the_chef_server "is empty" do it "knife list / returns all top level directories" do knife('list /').should_succeed < '' } cookbook 'cookbook2', '1.0.1', { 'metadata.rb' => '', 'recipes' => { 'default.rb' => '' } } data_bag 'bag1', { 'item1' => {}, 'item2' => {} } data_bag 'bag2', { 'item1' => {}, 'item2' => {} } environment 'environment1', {} environment 'environment2', {} node 'node1', {} node 'node2', {} role 'role1', {} role 'role2', {} user 'user1', {} user 'user2', {} it "knife list / returns all top level directories" do knife('list /').should_succeed < (Chef::Platform.windows?) do directory 'cookbooks' symlink 'symlinked', 'cookbooks' context 'when cwd is in cookbooks/' do cwd 'cookbooks' it "knife list -Rfp returns cookbooks" do knife('list -Rfp').should_succeed < (Chef::Platform.windows?) do directory 'real_cookbooks' symlink 'cookbooks', 'real_cookbooks' context 'when cwd is in real_cookbooks/' do cwd 'real_cookbooks' it "knife list -Rfp returns cookbooks" do knife('list -Rfp').should_succeed <