Sha256: 6b0e245fd7f39c4044ff8731511b9b516238ed95ae91d90f27c377f9a31ce852

Contents?: true

Size: 926 Bytes

Versions: 2

Compression:

Stored size: 926 Bytes

Contents

require 'json'
require 'rspec'
require 'redis'
require 'rack'
require 'rack/test'
require 'delorean'

ENV['RACK_ENV'] = "test"
ENV['FNORDMETRIC_ENV'] = 'test'

$: << ::File.expand_path('../../lib', __FILE__)
require "fnordmetric"
require "eventmachine"
require 'em-hiredis'

$: << ::File.expand_path('../../spec', __FILE__)
module FnordMetric::GaugeLike; end
require "gauge_like_shared"

def EM.defer; yield; end
def EM.next_tick; yield; end

class RedisWrap

  def initialize(redis, callbackable=true)
    @redis = redis
    @callbackable = callbackable
  end

  def method_missing(m, *args)    
    @last_return = @redis.send(m, *args)
    if ENV["VERBOSE_REDIS"]
      puts ">> REDIS: #{m} #{args.join(" ")} => #{@last_return}" 
    end
    @callbackable ? self : @last_return
  end

  def callback(&block)
    block.call(*@last_return)
  end

end

def key_error_klass
  RUBY_VERSION =~ /1.9.\d/ ? KeyError : IndexError
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fnordmetric-1.0.0 spec/spec_helper.rb
fnordmetric-0.9.7 spec/spec_helper.rb