Sha256: 171623ce143dac0ac8490a174a042c3a4fb77a2afc19efa33316ca71a5a44ee1

Contents?: true

Size: 738 Bytes

Versions: 4

Compression:

Stored size: 738 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'

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fnordmetric-0.7.1 spec/spec_helper.rb
fnordmetric-0.7.0 spec/spec_helper.rb
fnordmetric-0.6.6 spec/spec_helper.rb
fnordmetric-0.6.5 spec/spec_helper.rb