Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 50 lines (39 sloc) 1.214 kB
637827f @jurriaan Added API
jurriaan authored
1 require ::File.expand_path('../spec_helper.rb', __FILE__)
2
3 describe FnordMetric::Event do
4
5 include FnordMetric
6
7 before(:all) do
8 @now = Time.utc(1992,01,13,5,23,23).to_i
9 @redis = Redis.new
10 @redis_wrap = RedisWrap.new(@redis)
11
12 @namespace = "fnordmetric-test-ns1234-api"
13 @timeline = "#{@namespace}-timeline"
14
15 @opts = {
16 :namespace_prefix => "#{@namespace}",
17 :redis_prefix => "fnordmetric-test",
18 :redis => @redis
19 }
5639a1a @paulasmuth api_spec: fixed ruby 1.8.7 incompatibility issues
authored
20 @api = FnordMetric::API.new @opts
637827f @jurriaan Added API
jurriaan authored
21 end
22
30b0eff better api_spec + fixed api vs. inbound stream issues
Paul Asmuth authored
23 describe "creating events using API" do
637827f @jurriaan Added API
jurriaan authored
24
25 before(:each) do
26 @redis.keys("fnordmetric-test-*").each { |k| @redis.del(k) }
27 end
28
30b0eff better api_spec + fixed api vs. inbound stream issues
Paul Asmuth authored
29 it "should create an event from a (json-)string" do
30 json_string = {
31 :_type => "Fn0rd123",
32 :_time => @now
33 }.to_json
34 event_id = @api.event(json_string)
5639a1a @paulasmuth api_spec: fixed ruby 1.8.7 incompatibility issues
authored
35 event = FnordMetric::Event.find(event_id, @opts)
30b0eff better api_spec + fixed api vs. inbound stream issues
Paul Asmuth authored
36 event.type.should == "Fn0rd123"
637827f @jurriaan Added API
jurriaan authored
37 end
38
30b0eff better api_spec + fixed api vs. inbound stream issues
Paul Asmuth authored
39 it "should create an event from a hash" do
40 event_id = @api.event(
41 :_type => "Fn0rd234",
42 :_time => @now
43 )
5639a1a @paulasmuth api_spec: fixed ruby 1.8.7 incompatibility issues
authored
44 event = FnordMetric::Event.find(event_id, @opts)
30b0eff better api_spec + fixed api vs. inbound stream issues
Paul Asmuth authored
45 event.type.should == "Fn0rd234"
637827f @jurriaan Added API
jurriaan authored
46 end
47
48 end
49 end
Something went wrong with that request. Please try again.