Sha256: 02976fe156e2782f8388d17d409662f68b24481554cb973505c8f09c362d469b

Contents?: true

Size: 786 Bytes

Versions: 8

Compression:

Stored size: 786 Bytes

Contents

require 'spec_helper'

module ChefAPI
  describe Resource::PartialSearch do
    describe '.query' do
      it 'returns a partial search resource' do
        chef_server.send('create_client', 'bacon')
        results = described_class.query(:client, { name: ['name'] })
        expect(results).to be_a(described_class)
      end

      it 'returns partial data' do
        chef_server.send('create_node', 'bacon1', { foo: :bar })
        chef_server.send('create_node', 'bacon2', { foo: :baz, bar: :foo })
        keys = { data: ['bar'] }
        results = described_class.query(:node, keys, '*:*', start: 1)
        expect(results.total).to be == 2
        expect(results.rows.size).to be == 1
        expect(results.rows.first).to be == { 'data' => 'foo' }
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
chef-api-0.8.0 spec/integration/resources/partial_search_spec.rb
chef-api-0.7.1 spec/integration/resources/partial_search_spec.rb
chef-api-0.7.0 spec/integration/resources/partial_search_spec.rb
chef-api-0.6.0 spec/integration/resources/partial_search_spec.rb
chef-api-0.5.0 spec/integration/resources/partial_search_spec.rb
chef-api-0.4.1 spec/integration/resources/partial_search_spec.rb
chef-api-0.4.0 spec/integration/resources/partial_search_spec.rb
chef-api-0.3.0 spec/integration/resources/partial_search_spec.rb