Sha256: 564670af0299c8573ef5e9f929e30706581d57f4b87d51a03f977bce73c22c0e

Contents?: true

Size: 1.44 KB

Versions: 7

Compression:

Stored size: 1.44 KB

Contents

require 'bundler/setup'

require 'simplecov'
SimpleCov.start

require 'resque'
require 'sidekiq'
require 'delayed_job_active_record'
require 'sqlite3'

require 'harness'

require 'minitest/unit'
require 'minitest/autorun'

require 'webmock/minitest'

WebMock.disable_net_connect!

Harness.logger = Logger.new '/dev/null'

Harness.redis = Redis::Namespace.new 'harness-test', :redis => Redis.connect(:host => 'localhost', :port => '6379')

class IntegrationTest < MiniTest::Unit::TestCase
  def setup
    Harness.config.adapter = :memory
    Harness.config.queue = :synchronous

    gauges.clear ; counters.clear
    redis.flushall
  end

  def assert_gauge_logged(name)
    refute_empty gauges.select {|g| g.name = name }, "Expected #{gauges.inspect} to contain a #{name} result"
  end

  def assert_counter_logged(name)
    refute_empty counters.select {|c| c.name = name }, "Expected #{counters.inspect} to contain a #{name} result"
  end

  def refute_gauge_logged(name)
    assert_empty gauges.select {|g| g.name = name }, "No gauge expected to be logged"
  end

  def refute_counter_logged(name)
    assert_empty counters.select {|c| c.name = name }, "No counter expected to be logged"
  end

  def gauges
    Harness::MemoryAdapter.gauges
  end

  def counters
    Harness::MemoryAdapter.counters
  end

  def redis
    Harness.redis
  end

  def instrument(name, data = {})
    ActiveSupport::Notifications.instrument name, data do
      # nothing
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
harness-0.9.1 test/test_helper.rb
harness-0.9.0 test/test_helper.rb
harness-0.8.1 test/test_helper.rb
harness-0.8.0 test/test_helper.rb
harness-0.7.0 test/test_helper.rb
harness-0.6.0 test/test_helper.rb
harness-0.5.0 test/test_helper.rb