Sha256: 363af1f3667b8827849007a1b221f08c519144bb8d5a21fd27d0a51e1e205339

Contents?: true

Size: 507 Bytes

Versions: 14

Compression:

Stored size: 507 Bytes

Contents

module Janky
  module ChatService
    # Mock chat implementation used in testing environments.
    class Mock
      def initialize
        @rooms = {}
      end

      attr_writer :rooms

      def speak(room_name, message)
        if !@rooms.values.include?(room_name)
          raise Error, "Unknown room #{room_name.inspect}"
        end
      end

      def rooms
        acc = []
        @rooms.each do |id, name|
          acc << Room.new(id, name)
        end
        acc
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
janky-0.13.0.pre1 lib/janky/chat_service/mock.rb
janky-0.12.0 lib/janky/chat_service/mock.rb
janky-0.11.1 lib/janky/chat_service/mock.rb
janky-0.11.0 lib/janky/chat_service/mock.rb
janky-0.10.2 lib/janky/chat_service/mock.rb
janky-0.10.0 lib/janky/chat_service/mock.rb
janky-0.9.15 lib/janky/chat_service/mock.rb
janky-0.9.14 lib/janky/chat_service/mock.rb
janky-0.9.14.rc1 lib/janky/chat_service/mock.rb
janky-0.9.13 lib/janky/chat_service/mock.rb
janky-0.9.12 lib/janky/chat_service/mock.rb
janky-0.9.11 lib/janky/chat_service/mock.rb
janky-0.9.10 lib/janky/chat_service/mock.rb
janky-0.9.9 lib/janky/chat_service/mock.rb