Sha256: 59686110b6b24eff0155d533f2ca26aa13451e87c3fd36d634ac9b48b29cd68c

Contents?: true

Size: 886 Bytes

Versions: 6

Compression:

Stored size: 886 Bytes

Contents

require File.join(File.dirname(__FILE__), "../lib", "mixpanel")
require 'rack/test'
require 'fakeweb'
require 'nokogiri'
require 'cgi'

Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}

MIX_PANEL_TOKEN = "e2d8b0bea559147844ffab3d607d26a6"

# json hashes have string keys, convert to json and back to compare hashes
def mixpanel_queue_should_include(mixpanel, type, *arguments)
  event = mixpanel.queue.detect { |event| event[0] == type }
  event.should_not be_nil
  event_arguments = event[1]
  unjsonify(event_arguments).should == json_and_back(arguments)
end

def json_and_back array
  unjsonify array.collect { |arg| arg.to_json }
end

def unjsonify array
  array.collect { |arg| JSON.parse(arg) rescue arg }
end

# Fakeweb
FakeWeb.allow_net_connect = false
FakeWeb.register_uri(:any, /http:\/\/api\.mixpanel\.com.*/, :body => "1")

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mixpanel-4.1.1 spec/spec_helper.rb
mixpanel-4.1.0 spec/spec_helper.rb
mixpanel-4.0.9 spec/spec_helper.rb
mixpanel-4.0.8 spec/spec_helper.rb
mixpanel-4.0.7 spec/spec_helper.rb
mixpanel-4.0.6 spec/spec_helper.rb