Sha256: 9fe0d77044214aaaf30dd67e69de3eb4b3279047c907eb12055698257a1698b6

Contents?: true

Size: 888 Bytes

Versions: 5

Compression:

Stored size: 888 Bytes

Contents

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

class TestJabber < Minitest::Test

  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

5 entries across 5 versions & 3 rubygems

Version Path
resurrected_god-0.14.0 test/test_jabber.rb
mcproc-2016.2.20 test/test_jabber.rb
god-0.13.7 test/test_jabber.rb
god-0.13.6 test/test_jabber.rb
god-0.13.5 test/test_jabber.rb