Sha256: d5d5b085bd18ebfb24c7d98fff95f5fbd41c2d6324ab35eb8c66c3401fd90bd5

Contents?: true

Size: 824 Bytes

Versions: 2

Compression:

Stored size: 824 Bytes

Contents

require 'stringio'
require 'test/unit'
require 'rubygems'
require 'capistrano/logger'
require 'capistrano/configuration/variables'

class CapistranoMock

  include Capistrano::Configuration::Variables
  
  attr_reader :invocations

  def logbuf
    @logbuf ||= StringIO.new
  end

  def logger
    if @logger.nil?
      @logger = Capistrano::Logger.new :output=>logbuf
      @logger.level = Capistrano::Logger::MAX_LEVEL
    end
    @logger
  end

  %w(invoke_command capture stream run).each do |k|
    class_eval %Q{
  def #{k}(*args, &block)
    args = [args]
    args << block if block
    ((@invocations ||= {})[:#{k}] ||= []) << args
  end
}
  end

  def sudo(*args, &block)
    return 'sudo' if args.empty?
    args = [args]
    args << block if block
    ((@invocations ||= {})[:sudo] ||= []) << args
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capsaicin-0.1.11 test/helper.rb
capsaicin-0.1.10 test/helper.rb