Sha256: 1c09d8a6aebd50c0572f1505cb397d190d9b83187e9621de75be094f9a0100b9

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

require File.dirname(__FILE__) + "/../../helper"

class TestNotify < Test::Unit::TestCase
  include Biobot::Periodicals::Notify

  def setup
    @model = Biobot::Periodicals::Notify::Notification
    @model.stubs(:inspect).returns('Notification')
    @client = stub('Jabber::Client')
  end

  def test_handling_notifications
    notification = mock("notification", :to => 'foo@localhost', :body => 'huge')
    @model.expects(:count).returns(1)
    @model.expects(:all).returns([notification])
    outgoing = mock_message('biobot@localhost', 'huge')
    Jabber::Message.expects(:new).with('foo@localhost', 'huge').returns(outgoing)
    @client.expects(:send).with(outgoing)
    @model.expects(:delete_all)

    handle_notifications
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
viking-biobot-0.0.1 test/biobot/periodicals/test_notify.rb
viking-biobot-0.0.2 test/biobot/periodicals/test_notify.rb