Sha256: 1e813a76e9a3de35f3bcdaacc1ebd0bcb5e6b10e6d49962caf2b3085adbae34a
Contents?: true
Size: 1.67 KB
Versions: 3
Compression:
Stored size: 1.67 KB
Contents
RUBY_1_8 = defined?(RUBY_VERSION) && RUBY_VERSION < '1.9' exit(0) if RUBY_1_8 require 'simplecov' and SimpleCov.start { add_filter "/test|test_/" } if ENV["COVERAGE"] # Register `at_exit` handler for integration tests shutdown. # MUST be called before requiring `test/unit`. at_exit { Elasticsearch::Test::IntegrationTestCase.__run_at_exit_hooks } if ENV['SERVER'] require 'test/unit' require 'shoulda-context' require 'mocha/setup' require 'turn' unless ENV["TM_FILEPATH"] || ENV["NOTURN"] || RUBY_1_8 require 'ansi' require 'oj' require 'elasticsearch/extensions/test/cluster' require 'elasticsearch/extensions/test/startup_shutdown' require 'elasticsearch/persistence' module Elasticsearch module Test class IntegrationTestCase < ::Test::Unit::TestCase extend Elasticsearch::Extensions::Test::StartupShutdown startup { Elasticsearch::Extensions::Test::Cluster.start(nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running? } shutdown { Elasticsearch::Extensions::Test::Cluster.stop if ENV['SERVER'] && started? } context "IntegrationTest" do; should "noop on Ruby 1.8" do; end; end if RUBY_1_8 def setup tracer = ::Logger.new(STDERR) tracer.formatter = lambda { |s, d, p, m| "#{m.gsub(/^.*$/) { |n| ' ' + n }.ansi(:faint)}\n" } Elasticsearch::Persistence.client = Elasticsearch::Client.new \ host: "localhost:#{(ENV['TEST_CLUSTER_PORT'] || 9250)}", tracer: (ENV['QUIET'] ? nil : tracer) end def teardown Elasticsearch::Persistence.client.indices.delete index: '_all' end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
elasticsearch-persistence-0.1.4 | test/test_helper.rb |
elasticsearch-persistence-0.1.3 | test/test_helper.rb |
elasticsearch-persistence-0.0.1 | test/test_helper.rb |