Skip to content

Instantly share code, notes, and snippets.

@mhenrixon
Forked from anonymous/stub_partial_search.rb
Last active August 29, 2015 14:16
Show Gist options
  • Save mhenrixon/0ade32a7dba5cc272033 to your computer and use it in GitHub Desktop.
Save mhenrixon/0ade32a7dba5cc272033 to your computer and use it in GitHub Desktop.
# Public: Stubs partial search
# Examples =>
# stub_partial_search(:node, 'name:web*').and_return([{ 'fqdn' => 'web01.example.com' }])
#
def stub_partial_search(type, query)
allow(Chef).to receive(:partial_search).and_call_original
expect(Chef).to receive(:partial_search).with(type, query, any_args)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment