Class: Sappho::Socket::MockSocketSession
- Inherits:
-
Object
- Object
- Sappho::Socket::MockSocketSession
- Defined in:
- lib/sappho-socket/mock_socket.rb
Instance Method Summary collapse
- #action(expectedActivityType, *parameters) ⇒ Object
-
#initialize(activities) ⇒ MockSocketSession
constructor
A new instance of MockSocketSession.
Constructor Details
#initialize(activities) ⇒ MockSocketSession
Returns a new instance of MockSocketSession.
43 44 45 46 |
# File 'lib/sappho-socket/mock_socket.rb', line 43 def initialize activities @activities = activities @index = -1 end |
Instance Method Details
#action(expectedActivityType, *parameters) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/sappho-socket/mock_socket.rb', line 48 def action expectedActivityType, *parameters activity = @activities[@index += 1] activityType = activity[:type] unless activityType == expectedActivityType raise MockSocketSessionError, "Expected #{activityType} call but code under test asked for #{expectedActivityType}" end activity[:action].action *parameters end |