Sha256: 312d5d02b1df52087df05e64601b69ef58436d83f73b565f18cc6b56866365e2

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require File.dirname(__FILE__) + '/helper'
require 'tinder'

class TestCampfire < Test::Unit::TestCase
  def test_exists
    Monitr::Contacts::Campfire
  end
  
  # should notify
  def test_campfire_delivery_method_for_notify
    assert_nothing_raised do
      
      room = mock()
      room.expects(:speak).returns(nil)
      
      g = Monitr::Contacts::Campfire.new
      Monitr::Contacts::Campfire.format.expects(:call).with(:a,:e)
      g.expects(:room).returns(room)
      g.notify(:a, :b, :c, :d, :e)
      assert_equal "notified campfire: ", g.info
    end
  end
  
  # should not establish a new connection because the older is alive
  def test_campfire_room_method
   assert_nothing_raised do
     room = mock()
     g = Monitr::Contacts::Campfire.new
     g.instance_variable_set(:@room,room)
     assert_equal g.send(:room), room
   end
  end
  
  # should raise because the connections parameters have not been set
  def test_campfire_delivery_method_for_notify_without_campfire_params
    LOG.expects(:log).times(3) # 3 calls: 2 debug (credentials, backtrace) + 1 info (failed message)
    g = Monitr::Contacts::Campfire.new
    g.notify(:a, :b, :c, :d, :e)
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
monitr-0.0.1 test/test_campfire.rb