Sha256: 001a42260f5e4b3615b6946b2f9a16d39467fc019aa7301895f47595e88ad777
Contents?: true
Size: 1.56 KB
Versions: 3
Compression:
Stored size: 1.56 KB
Contents
require "#{File.dirname(__FILE__)}/test_helper" require 'xmpp4r-simple' module Messenger class JabberTest < Test::Unit::TestCase context "Jabber notification" do setup do @successful_jabber = stub("jabber", :deliver => nil, :queue => stub("queue", :size => 0), :subscribed_to? => true) @failed_jabber = stub("jabber", :deliver => nil, :queue => stub("queue", :size => 0), :subscribed_to? => false) end should "send a successful jabber message" do ::Jabber::Simple.expects(:new).with("notifier@zencoder.com", "asdfasdf", nil).returns(@successful_jabber) result = Jabber.send("jabber://brandon@zencoder.com", "Test message", :jabber_id => "notifier@zencoder.com", :jabber_password => "asdfasdf") assert_equal [true, nil], result end should "determine and set the jabber host" do ::Jabber::Simple.expects(:new).with("notifier@zencoder.com", "asdfasdf", "host.com").returns(@successful_jabber) result = Jabber.send("jabber://brandon@zencoder.com/host.com", "Test message", :jabber_id => "notifier@zencoder.com", :jabber_password => "asdfasdf") assert_equal [true, nil], result end should "fail if the recipient is not subscribed" do ::Jabber::Simple.expects(:new).with("notifier@zencoder.com", "asdfasdf", nil).returns(@failed_jabber) result = Jabber.send("jabber://brandon@zencoder.com", "Test message", :jabber_id => "notifier@zencoder.com", :jabber_password => "asdfasdf") assert_equal [false, "Not yet authorized"], result end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
messenger-0.0.3 | test/test_jabber.rb |
messenger-0.0.2 | test/test_jabber.rb |
messenger-0.0.1 | test/test_jabber.rb |