Sha256: 76e78cf7adbcd68a24fbba2462bd9018c6f4be6e38ea39d1600e72aa21d6baca

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

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

module Roflbot
  class TestBase < Test::Unit::TestCase
    def test_new
      Net::TOC.expects(:new).with("roflbot", "password").returns(@client)
      roflbot = Base.new("roflbot", "password")
    end

    def test_connect
      roflbot = Base.new("roflbot", "password")
      @client.expects(:connect)
      roflbot.connect
    end

    def test_wait
      roflbot = Base.new("roflbot", "password")
      @client.expects(:wait)
      roflbot.wait
    end

    def test_disconnect
      roflbot = Base.new("roflbot", "password")
      @client.expects(:disconnect)
      roflbot.disconnect
    end

    def test_responds_with_string
      roflbot = Base.new("roflbot", "password")
      roflbot.expects(/^hey$/).responds("oh hai")

      @buddy.expects(:send_im).with("oh hai")
      receive_im("hey")
    end

    def test_responds_with_block
      roflbot = Base.new("roflbot", "password")
      roflbot.expects(/^hey$/).responds { "omg wtf" }

      @buddy.expects(:send_im).with("omg wtf")
      receive_im("hey")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
roflbot-0.0.1 test/roflbot/test_base.rb
roflbot-0.0.0 test/roflbot/test_base.rb