RUBY_1_8 = defined?(RUBY_VERSION) && RUBY_VERSION < '1.9' if RUBY_1_8 require 'rubygems' gem 'test-unit' end require 'simplecov' and SimpleCov.start { add_filter "/test|test_/" } if ENV["COVERAGE"] require 'test/unit' require 'shoulda-context' require 'mocha/setup' unless ENV["TM_FILEPATH"] || ENV["NOTURN"] || RUBY_1_8 require 'turn' if ENV['QUIET'] Turn.config.format = :outline Turn.config.trace = 1 end end require 'require-prof' if ENV["REQUIRE_PROF"] require 'elasticsearch/api' RequireProf.print_timing_infos if ENV["REQUIRE_PROF"] module Elasticsearch module Test class FakeClient include Elasticsearch::API def perform_request(method, path, params, body) puts "PERFORMING REQUEST:", "--> #{method.to_s.upcase} #{path} #{params} #{body}" FakeResponse.new(200, 'FAKE', {}) end end FakeResponse = Struct.new(:status, :body, :headers) do def status values[0] || 200 end def body values[1] || '{}' end def headers values[2] || {} end end class NotFound < StandardError; end end end