Class: Janky::ChatService::Mock
- Inherits:
-
Object
- Object
- Janky::ChatService::Mock
- Defined in:
- lib/janky/chat_service/mock.rb
Overview
Mock chat implementation used in testing environments.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Mock
constructor
A new instance of Mock.
- #speak(room_name, message) ⇒ Object
Constructor Details
#initialize ⇒ Mock
Returns a new instance of Mock.
5 6 7 |
# File 'lib/janky/chat_service/mock.rb', line 5 def initialize @rooms = {} end |
Instance Attribute Details
#rooms ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/janky/chat_service/mock.rb', line 17 def rooms acc = [] @rooms.each do |id, name| acc << Room.new(id, name) end acc end |
Instance Method Details
#speak(room_name, message) ⇒ Object
11 12 13 14 15 |
# File 'lib/janky/chat_service/mock.rb', line 11 def speak(room_name, ) if !@rooms.values.include?(room_name) raise Error, "Unknown room #{room_name.inspect}" end end |