Sha256: 7648df1037b625f70b2a9e35044a53f64c4dab2c465e852160c42ec46a9935c0

Contents?: true

Size: 735 Bytes

Versions: 1

Compression:

Stored size: 735 Bytes

Contents

module Support
  module Mocks
    class Irc
      def initialize
        @output = []
      end

      def join(channel, password = nil, &block)
        @channel = "##{channel}"
        password = password && " #{password}" || ""

        say "JOIN #{@channel}#{password}"

        instance_eval(&block) and leave if block_given?
      end

      def run(&block)
        instance_eval(&block) if block_given?
      end

      def leave
        say "PART #{@channel}"
      end

      def say(message)
        say "PRIVMSG #{@channel} :#{message}" if @channel
      end

      def quit
        say "QUIT"
      end

      def say(output)
        @output << output
      end

      def output
        @output
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
travis-core-0.0.1 spec/support/mocks/irc.rb