Sha256: 5553fcd477b94a5343fab5ec9da38957977d6e7749d1d638371cd50300c827bd

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

require 'coverage_helper'
require 'minitest/autorun'
require 'turn'
require 'yaml'
require 'datacenter'

Turn.config do |c|
  c.format = :pretty
  c.natural = true
  c.ansi = true
end

module Datacenter
  module Shell
    class Mock

      def initialize(file=nil)
        @commands = file ? YAML.load_file(file) : {}
      end

      def stub(command, value=nil, &block)
        commands[command] = value || block.call
      end

      def run(command)
        raise "Undefined command: #{command}" unless commands.key? command
        commands[command]
      end

      private

      attr_reader :commands

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datacenter-0.0.1 spec/minitest_helper.rb