spec/eotb_spec.rb in eotb-0.5.11 vs spec/eotb_spec.rb in eotb-0.5.12
- old
+ new
@@ -1,16 +1,9 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe Eotb do
- it "should log errors" do
- logger = mock(Logger)
- logger.stub(:new) { logger }
- logger.stub(:error) { @response }
- Eotb.register_event(:actor, :action, {:username => "John"}).should == @response
- end
-
describe "shoud format objects" do
before do
@@counter = 0
end
@@ -30,19 +23,20 @@
describe "should register data" do
before(:each) do
@response = "200"
- Eotb.configure("0"*40, 1)
+
+ Eotb.configure("0"*40)
+ @@counter = 100
Net::HTTP.stub(:new) { Net::HTTP }
Net::HTTP.stub(:start) { Net::HTTP }
Net::HTTP.stub(:request) { "200" }
end
it "should register two arguments" do
Eotb.register_event("actor", "action").should == @response
- Eotb.register_event("act2or", "acti2on").should == @response
end
it "should register three arguments" do
Eotb.register_event("actor", "action", {:username => "John"}).should == @response
end
@@ -61,20 +55,25 @@
it "should register nested hashes" do
Eotb.register_event({:type => { :account => "User"}}, :action, {:username => {:first_name => "John"}}).should == @response
end
+ it "should register JSON messages" do
+ Eotb.register_event('{"actor":{"type":{"account":"User"}},"action":"action","subject":{"username":{"first_name":"John"}}}').should == @response
+ end
+
it "should register arrays" do
Eotb.register_event([2,3,4], :action, {:username => ["John", "Josh"]}).should == @response
end
end
describe "should register data in one package" do
before(:each) do
@response = "200"
- Eotb.configure("0"*40, 5)
+ Eotb.configure("0"*40)
+ @@counter = 96
Net::HTTP.stub(:new) { Net::HTTP }
Net::HTTP.stub(:start) { Net::HTTP }
Net::HTTP.stub(:request) { "200" }
end