Sha256: c89e21d3c0c10849bf94ad732232efa14bd7e4f2563c853ee37781cf6635bf54

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe FluQ::Event do

  subject { described_class.new :"some.tag", "1313131313", "a" => "v1", "b" => "v2" }

  it { should be_a(Hash) }
  its(:tag)        { should == "some.tag" }
  its(:timestamp)  { should == 1313131313 }
  its(:time)       { should be_instance_of(Time) }
  its(:time)       { should be_utc }
  its(:to_a)       { should == ["some.tag", 1313131313, "a" => "v1", "b" => "v2"] }
  its(:to_tsv)     { should == %(some.tag\t1313131313\t{"a":"v1","b":"v2"}) }
  its(:to_json)    { should == %({"a":"v1","b":"v2","=":"some.tag","@":1313131313}) }
  its(:to_msgpack) { should == "\x84\xA1a\xA2v1\xA1b\xA2v2\xA1=\xA8some.tag\xA1@\xCEND\xCB1".force_encoding(Encoding::BINARY) }
  its(:inspect)    { should == %(["some.tag", 1313131313, {"a"=>"v1", "b"=>"v2"}]) }

  it "should be comparable" do
    subject.should == { "a" => "v1", "b" => "v2" }
    subject.should == ["some.tag", 1313131313, "a" => "v1", "b" => "v2"]
    [subject].should == [{ "a" => "v1", "b" => "v2" }]
    [subject, subject].should == [["some.tag", 1313131313, "a" => "v1", "b" => "v2"]] * 2
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fluq-0.7.5 spec/fluq/event_spec.rb
fluq-0.7.3 spec/fluq/event_spec.rb
fluq-0.7.1 spec/fluq/event_spec.rb
fluq-0.7.0 spec/fluq/event_spec.rb