Sha256: 77d9d0bb30c2bba96955d4252f6bfa650aa3352c829c83c4340804d92234554b

Contents?: true

Size: 976 Bytes

Versions: 10

Compression:

Stored size: 976 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

include Rack::Test::Methods
include FnordMetric

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
johnf-fnordmetric-1.2.10 spec/spec_helper.rb
fnordmetric-1.2.9 spec/spec_helper.rb
johnf-fnordmetric-1.2.7 spec/spec_helper.rb
bp-fnordmetric-1.2.7 spec/spec_helper.rb
fnordmetric-1.2.7 spec/spec_helper.rb
fnordmetric-1.2.6 spec/spec_helper.rb
fnordmetric-1.2.4 spec/spec_helper.rb
fnordmetric-1.2.1 spec/spec_helper.rb
fnordmetric-1.2.0 spec/spec_helper.rb
fnordmetric-1.0.1 spec/spec_helper.rb