Sha256: 80ecefe2f6907220fde8087e86c0236fcb424de0176069dfec6894fcbe81e69f

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

module ChainReactor
  module TestHelpers
    class Logger
      def debug
      end
      def info
      end
      def warning
      end
      def error
      end
      def fatal
      end
    end

    # KeyError doesn't exist in ruby 1.8
    if !defined? ::KeyError
      class ::KeyError < ::IndexError
      end
    end

    class Params
      def initialize(hash_data)
        @hash = hash_data
      end

      def method_missing(name, *args, &block)
        @hash.send(name, *args, &block)
      end

      def fetch(key,&block)
        begin
          @hash.fetch(key,&block)
        rescue ::KeyError,::IndexError => e
          raise ::Main::Parameter::NoneSuch, key
        end
      end

    end

    class CliParam
      def initialize(value)
        @value = value
        @given = true
      end

      def value
        @value
      end

      def given=(given)
        @given = given
      end

      def given?
        @given
      end
    end

    class File
      def initialize(string)
        @string = string
      end

      def read
        @string
      end
    end

    def get_logger
      Logger.new
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chain-reactor-0.2.2 test/helpers.rb
chain-reactor-0.2.1 test/helpers.rb