Permalink
Browse files

Feature: Added _receive_raw method to make hooking extra code in easier

  • Loading branch information...
1 parent d993bbc commit b713dd9abce8240b9745ee1e16663fdeb3340647 Theo Cushion committed Apr 27, 2012
Showing with 12 additions and 0 deletions.
  1. +9 −0 spec/javascripts/ConnectionSpec.js
  2. +3 −0 src/connection/connection.js
@@ -10,6 +10,15 @@ describe("Connection",function(){
subject.receive("<message type='chat' to='bob@bar.com' from='alice@bar.com'><body>hello there</body></message>");
});
+ it("should pass the unmodified stanza to _receive_raw", function(){
+ var stanza = "<message id='a' type='chat' to='bob@bar.com' from='alice@bar.com'><body>hello there</body></message>";
+
+ new Mock(subject);
+ subject.expects('_receive_raw').passing(stanza);
+
+ subject.receive(stanza);
+ });
+
it("should call the callback list with proper arguments", function(){
var object = {special_object: true, get: function(thing){return thing == "is_success";}};
@@ -14,7 +14,10 @@ Frabjous.Connection = Ember.Object.create({
_send_now: function(stanza){
Frabjous.Log.error("Please override _send_now with the adapter you want to use");
},
+ _receive_raw: function(stanza){},
receive: function(stanza){
+ this._receive_raw(stanza);
+
// Called when a XMPP stanza is received
var s = new Frabjous.Stanza(stanza);

0 comments on commit b713dd9

Please sign in to comment.