spec/eotb_spec.rb in eotb-0.0.2 vs spec/eotb_spec.rb in eotb-0.1.0
- old
+ new
@@ -1,22 +1,22 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe Eotb do
- context "register_event method" do
-
- it "should return json" do
- subject = { :user_id => 10, :user_name => "Noname" }
- Eotb.new.register_event(:current_user, :bought_membership, subject).should eql JSON.generate([:current_user, :bought_membership, subject])
- end
-
+ before(:each) do
+ @eotb = Eotb.new('0')
+ @data = [:actor, :action, {:username => 'Vuvuzela'}]
end
- context "connection with app" do
-
- it "should set connection"
-
- it "should send json by POST to app"
-
+ it "should check connection status" do
+ @eotb.http.get('/').code.should eql('200')
+ end
+
+ it "should have data in json" do
+ @eotb.to_json(@data).should eql(JSON.generate(@data))
+ end
+
+ it "should post data in json" do
+ @eotb.register_event(@data[0], @data[1], @data[2]).code.should eql('200')
end
end
\ No newline at end of file