Class: Zerg::Support::Sockets::SendMock

Inherits:
Object
  • Object
show all
Defined in:
lib/zerg_support/sockets/socket_mocks.rb

Overview

Mocks the sending end of a Socket connection. The sent data is concatenated in a string available by calling #string.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSendMock

Returns a new instance of SendMock.



9
10
11
# File 'lib/zerg_support/sockets/socket_mocks.rb', line 9

def initialize
  @string = ''
end

Instance Attribute Details

#stringObject (readonly)

Returns the value of attribute string.



7
8
9
# File 'lib/zerg_support/sockets/socket_mocks.rb', line 7

def string
  @string
end

Instance Method Details

#send(data, flags) ⇒ Object



13
14
15
# File 'lib/zerg_support/sockets/socket_mocks.rb', line 13

def send(data, flags)
  @string << data
end