Sha256: 3c3aa8b9c0b711c145aee2852aabadcf76d0a44988303c4024d10cc9ec4df0fe

Contents?: true

Size: 894 Bytes

Versions: 7

Compression:

Stored size: 894 Bytes

Contents

#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/helper'

class TestJabber < Test::Unit::TestCase

  def setup
    @jabber = God::Contacts::Jabber.new
  end

  def test_notify
    @jabber.host = 'talk.google.com'
    @jabber.from_jid = 'god@jabber.org'
    @jabber.password = 'secret'
    @jabber.to_jid = 'dev@jabber.org'

    time = Time.now
    body = God::Contacts::Jabber.format.call('msg', time, 'prio', 'cat', 'host')

    assert_equal "Message: msg\nHost: host\nPriority: prio\nCategory: cat\n", body

    Jabber::Client.any_instance.expects(:connect).with('talk.google.com', 5222)
    Jabber::Client.any_instance.expects(:auth).with('secret')
    Jabber::Client.any_instance.expects(:send)
    Jabber::Client.any_instance.expects(:close)

    @jabber.notify('msg', Time.now, 'prio', 'cat', 'host')
    assert_equal "sent jabber message to dev@jabber.org", @jabber.info
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
god-0.13.4 test/test_jabber.rb
god-0.13.3 test/test_jabber.rb
god-0.13.2 test/test_jabber.rb
god-0.13.1 test/test_jabber.rb
god-0.13.0 test/test_jabber.rb
god-0.12.1 test/test_jabber.rb
god-0.12.0 test/test_jabber.rb