global
def search(*args, &block)
- See: Chef::DSL::DataQuery#search -
def search(*args, &block) return super unless Chef::Config[:solo] && $CHEFSPEC_MODE type = args[0] query = args[1] || "*:*" stub = ChefSpec::Stubs::SearchRegistry.stub_for(type, query) if stub.nil? raise ChefSpec::Error::SearchNotStubbed.new(args: [type, query]) end if block Array(stub.result).each { |r| block.call(r) } true else stub.result end end