Sha256: 8a2e77c7b3a72a0a3a94a5b63415de347ebeaea597384fc64c4fe124e4521e0b

Contents?: true

Size: 1.39 KB

Versions: 11

Compression:

Stored size: 1.39 KB

Contents

require 'simplecov'
SimpleCov.start

require 'resque'
require 'sidekiq'

require 'harness'

require 'minitest/unit'
require 'minitest/pride'
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 = :syncronous

    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

11 entries across 11 versions & 1 rubygems

Version Path
harness-0.2.15 test/test_helper.rb
harness-0.2.14 test/test_helper.rb
harness-0.2.13 test/test_helper.rb
harness-0.2.12 test/test_helper.rb
harness-0.2.11 test/test_helper.rb
harness-0.2.10 test/test_helper.rb
harness-0.2.9 test/test_helper.rb
harness-0.2.8 test/test_helper.rb
harness-0.2.7 test/test_helper.rb
harness-0.2.6 test/test_helper.rb
harness-0.2.5 test/test_helper.rb