Sha256: ba09b0903ea61fb17ee97a5d1e0cf928b8046ca734d9624ab4b7c56dc829d246
Contents?: true
Size: 1.12 KB
Versions: 3
Compression:
Stored size: 1.12 KB
Contents
require File.dirname(__FILE__) + "/../../test_helper" require 'adhearsion/voip/freeswitch/inbound_connection_manager' include Adhearsion::VoIP::FreeSwitch context "A FreeSwitch InboundConnectionManager" do test "authenticatating with the given password" do manager = InboundConnectionManager.new io_mock manager.login password end test "a hash is accepted when creating a new InboundConnectionManager" do host, port = "myhost.mydomain", 31337 flexmock(TCPSocket).should_receive(:new).once.with(host, port).and_return io_mock InboundConnectionManager.new :host => host, :port => port, :pass => password end test "an IO is accepted when creating a new InboundConnectionManager" private def io_mock @io_mock ||= begin io_mock = StringIO.new flexmock(io_mock) do |io| io.should_receive(:write).with("auth #{password}\n\n") io.should_receive(:gets).and_return "connection: kthnx\n", "\n", "login: +OK\n", "\n" end io_mock end end def password "supersecret" end end
Version data entries
3 entries across 3 versions & 2 rubygems