Sha256: 1c668697cbfa02f22e5dbb6b551c40c64a31b4c6a61990227e417e7a7dd887c6

Contents?: true

Size: 1.57 KB

Versions: 3

Compression:

Stored size: 1.57 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Eotb do
  
  before(:all) do
    @response = "200"
    Eotb.configure("0"*24)
  end
  
  it "should format actor in string" do
    Eotb.hash_format("actor", :actor).should == {"event[actor]" => "actor"}
  end
  
  it "should format actor in hash" do
    Eotb.hash_format({:type => "User"}, :actor).should == {"event[actor][type]" => "User"}
  end
  
  it "should format actor in nested hash" do
    Eotb.hash_format({:type => { :account => "User"}}, :actor).should == {"event[actor][type][account]" => "User"}
  end
  
  it "should register two arguments" do
    Eotb.register_event("actor", "action").code.should == @response
  end
  
  it "should register three arguments" do
    Eotb.register_event("actor", "action", {:username => "John"}).code.should == @response
  end
  
  it "should register symbols" do
    Eotb.register_event(:actor, :action, {:username => "John"}).code.should == @response
  end
  
  it "should register objects" do
    Eotb.register_event(Object.new, :action, {:username => Object.new}).code.should == @response
  end

  it "should register hashes" do
    Eotb.register_event({:type => "User"}, :action, {:username => {:first_name => "John"}}).code.should == @response
  end
  
  it "should register nested hashes" do
    Eotb.register_event({:type => { :account => "User"}}, :action, {:username => {:first_name => "John"}}).code.should == @response
  end
  
  it "should register arrays" do
    Eotb.register_event([2,3,4], :action, {:username => ["John", "Josh"]}).code.should == @response
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eotb-0.4.4 spec/eotb_spec.rb
eotb-0.4.3 spec/eotb_spec.rb
eotb-0.4.2 spec/eotb_spec.rb