Sha256: d8976bc1063386cb13a2b18164ce8e7a5c3404fc23dbdf0eb7ebfe223dfdb4eb

Contents?: true

Size: 786 Bytes

Versions: 4

Compression:

Stored size: 786 Bytes

Contents

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

module Roflbot
  class TestRunner < Test::Unit::TestCase
    def setup
      super
      @bot = stub("SentenceBot", :start => nil, :wait => nil, :options => {})
      SentenceBot.stubs(:new).returns(@bot)
    end

    def test_runs_sentence_bot
      @bot.expects(:start)
      @bot.expects(:wait)
      SentenceBot.expects(:new).with({ "foo" => "bar" }).returns(@bot)
      Runner.new(%W{-c #{create_config("bogus.yml")}})
    end

    def test_stop
      config = create_config("bogus.yml")
      runner = Runner.new(%W{-c #{config}})
      @bot.stubs(:options).returns({ "omg" => "whoa" })

      @bot.expects(:stop)
      runner.stop

      hash = YAML.load_file(config)
      assert_equal({ "omg" => "whoa" }, hash)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roflbot-0.0.6 test/roflbot/test_runner.rb
roflbot-0.0.5 test/roflbot/test_runner.rb
roflbot-0.0.4 test/roflbot/test_runner.rb
roflbot-0.0.3 test/roflbot/test_runner.rb