Sha256: 68ea0306be9c34562c6e69dd3f8d9ba4c582f88df09a3d70bbac3d6acc0d4f74
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
Object.send(:remove_const, :Jabber) class Jabber class Client def initialize(user) @user = user end def connect @connected = true end def auth(pw) @pw = pw end def is_connected? @connected end def close @connected = nil end attr_reader :sent def send(msg) @sent ||= [] @sent << msg end attr_reader :on_message def add_message_callback(&block) @on_message = block end # TESTING HELPER METHODS def receive_message(from,body,type=:chat) msg = Message.new(nil) msg.type = type msg.body = body msg.from = from @on_message[msg] end end class Presence attr_accessor :from def initialize(a,b) end def from end end class Message attr_accessor :type, :body, :from def initialize(to) @to = to end end class Roster class Helper def initialize(client) @client = client end def accept_subscription(a) end attr_reader :on_subscription_request def add_subscription_request_callback(&block) @on_subscription_request = block end def add_presence_callback(&block) @on_presence = block end def add_subscription_callback(&block) @on_subscription = block end end end class JID def self.fake_jid new 'foo', 'bar.com', 'baz' end def initialize(node,domain,res) @node, @domain, @res = node, domain, res end def bare self.class.new @node, @domain, nil end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tyler-uppercut-0.6.2 | spec/jabber_stub.rb |