Sha256: 9bb455e942c6c4b25df6296880908c67759c640708eb1fc38c80762c390a5054
Contents?: true
Size: 1.15 KB
Versions: 7
Compression:
Stored size: 1.15 KB
Contents
require ::File.expand_path('../spec_helper.rb', __FILE__) describe FnordMetric::Event do include FnordMetric before(:all) do @now = Time.utc(1992,01,13,5,23,23).to_i @redis = Redis.new @redis_wrap = RedisWrap.new(@redis) @namespace = "fnordmetric-test-ns1234-api" @timeline = "#{@namespace}-timeline" @opts = { :namespace_prefix => "#{@namespace}", :redis_prefix => "fnordmetric-test", :redis => @redis } @api = API.new @opts end describe "creating events using API" do before(:each) do @redis.keys("fnordmetric-test-*").each { |k| @redis.del(k) } end it "should create an event from a (json-)string" do json_string = { :_type => "Fn0rd123", :_time => @now }.to_json event_id = @api.event(json_string) event = Event.find(event_id, @opts) event.type.should == "Fn0rd123" end it "should create an event from a hash" do event_id = @api.event( :_type => "Fn0rd234", :_time => @now ) event = Event.find(event_id, @opts) event.type.should == "Fn0rd234" end end end
Version data entries
7 entries across 7 versions & 1 rubygems