Sha256: e5f5de532709edf5d8978fb7dd5fb6919128f2e630ce4224d89d319ba0f7e62d

Contents?: true

Size: 817 Bytes

Versions: 6

Compression:

Stored size: 817 Bytes

Contents

require 'coverage_helper'
require 'minitest/autorun'
require 'turn'
require 'yaml'
require 'datacenter'
require 'pry-nav'

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

class Module
  include Minitest::Spec::DSL
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

class Minitest::Spec
  let(:mock_shell) { Datacenter::Shell::Mock.new File.expand_path('../commands.yml', __FILE__) }
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
datacenter-0.4.2 spec/minitest_helper.rb
datacenter-0.4.0 spec/minitest_helper.rb
datacenter-0.3.1 spec/minitest_helper.rb
datacenter-0.2.2 spec/minitest_helper.rb
datacenter-0.2.1 spec/minitest_helper.rb
datacenter-0.2.0 spec/minitest_helper.rb