Sha256: b21962974c2e19a6e34efb97cf8456c240fda178c58f18f11181a363c9bfd222

Contents?: true

Size: 892 Bytes

Versions: 10

Compression:

Stored size: 892 Bytes

Contents

require 'rubygems'
require 'bundler/setup'

require 'test/unit'
require 'mocha'

require 'capistrano/server_definition'
require 'pry'

module TestExtensions
  def server(host, options={})
    Capistrano::ServerDefinition.new(host, options)
  end

  def namespace(fqn=nil)
    space = stub(:roles => {}, :fully_qualified_name => fqn, :default_task => nil)
    yield(space) if block_given?
    space
  end

  def role(space, name, *args)
    opts = args.last.is_a?(Hash) ? args.pop : {}
    space.roles[name] ||= []
    space.roles[name].concat(args.map { |h| Capistrano::ServerDefinition.new(h, opts) })
  end

  def new_task(name, namespace=@namespace, options={}, &block)
    block ||= Proc.new {}
    task = Capistrano::TaskDefinition.new(name, namespace, options, &block)
    assert_equal block, task.body
    return task
  end
end

class Test::Unit::TestCase
  include TestExtensions
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
capistrano-2.15.11 test/utils.rb
capistrano-2.15.10 test/utils.rb
capistrano-2.15.9 test/utils.rb
capistrano-2.15.8 test/utils.rb
capistrano-2.15.7 test/utils.rb
capistrano-2.15.6 test/utils.rb
capistrano-2.15.5 test/utils.rb
vergissberlin-0.0.7 test/utils.rb
minmb-capistrano-2.15.4 test/utils.rb
capistrano-2.15.4 test/utils.rb