Sha256: a2a335b3ab3e1d55f6e88885630901a2fdaf5616a6894bf83c0a6795e9379856
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
require File.dirname(__FILE__) + "/../lib/rmpd" def mock_socket socket = mock(Socket) socket.stub!(:puts) socket.stub!(:closed?).and_return(false) socket.stub!(:connect) socket.stub!(:eof?).and_return(false) Socket.stub!(:pack_sockaddr_in).and_return("pack_sockaddr_in") Socket.stub!(:new).and_return(socket) socket end def mock_config(opts={}) opts = { :hostname => Rmpd::Config::DEFAULT_HOSTNAME, :port => Rmpd::Config::DEFAULT_PORT, :password => Rmpd::Config::DEFAULT_PASSWORD, }.merge(opts) config = mock(Rmpd::Config) config.stub!(:hostname).and_return(opts[:hostname]) config.stub!(:password).and_return(opts[:password]) config.stub!(:port).and_return(opts[:port]) Rmpd::Config.stub!(:new).and_return(config) config end def connect_response(version="0.12.0") ok("MPD #{version}") end def connect_and_auth_responses connect_response + ok end def playlist_id_response @id ||= 0 ["Id: #{@id += 1}"] end def ok(txt="") txt ? ["OK #{txt}\n"] : ["OK\n"] end def ack(x=1, y=2, cmd="foo_command", msg="No one's home dopey!") ["ACK [#{x}@#{y}] {#{cmd}} #{msg}"] end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rmpd-1.0.4 | spec/spec_helper.rb |
rmpd-1.0.3 | spec/spec_helper.rb |
rmpd-1.0.2 | spec/spec_helper.rb |