Sha256: 6f784817946487b10c4daee195107b2c723ebd2d65bc64dcf3364c6c6988e176

Contents?: true

Size: 534 Bytes

Versions: 5

Compression:

Stored size: 534 Bytes

Contents

require 'puppet-lint'
require 'jgrep'

PuppetLint::Plugins.load_spec_helper

class PuppetDB::Client
  def puppetdb_to_jgrep(query)
    if query[0] == :'and' || query[0] == :'or'
      "(#{puppetdb_to_jgrep(query[1])} #{query[0]} #{puppetdb_to_jgrep(query[2])})"
    else
      "#{[query[1]].flatten.join('.')}#{query[0]}#{query[2]}"
    end
  end

  def request(endpoint, query, opts={})
    ret = JGrep.jgrep(File.read("spec/fixtures/#{endpoint}.json"), puppetdb_to_jgrep(query))
    PuppetDB::Response.new(ret, ret.size)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
puppet-ghostbuster-0.8.0 spec/spec_helper.rb
puppet-ghostbuster-0.7.3 spec/spec_helper.rb
puppet-ghostbuster-0.7.2 spec/spec_helper.rb
puppet-ghostbuster-0.7.1 spec/spec_helper.rb
puppet-ghostbuster-0.7.0 spec/spec_helper.rb