Sha256: 38fd89937bcccdfd50900794d2981f9f7cc113328406fd8ffa9bdf4ed172c818

Contents?: true

Size: 900 Bytes

Versions: 31

Compression:

Stored size: 900 Bytes

Contents

begin
  require 'rubygems'
  gem     'mocha'
rescue LoadError
end

require 'test/unit'
require 'mocha'
require 'capistrano/server_definition'

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

31 entries across 31 versions & 10 rubygems

Version Path
wulffeld-capistrano-2.5.8.3 test/utils.rb
dan-capistrano-2.5.6 test/utils.rb
fotonauts-capistrano-2.5.2 test/utils.rb
mattmatt-cap-ext-parallelize-0.1.1 test/utils.rb
mattmatt-cap-ext-parallelize-0.1.2 test/utils.rb
mbailey-capistrano-2.5.5 test/utils.rb
mbailey-capistrano-2.5.6 test/utils.rb
mbailey-capistrano-2.5.7 test/utils.rb
sneakin-capistrano-2.5.5 test/utils.rb
thoughtbot-capistrano-2.5.5 test/utils.rb
thoughtbot-capistrano-2.5.6 test/utils.rb
wulffeld-capistrano-2.5.8.1 test/utils.rb
wulffeld-capistrano-2.5.8 test/utils.rb
cap-ext-parallelize-0.1.2 test/utils.rb
wulffeld-capistrano-2.5.8.2 test/utils.rb
capistrano-2.5.9 test/utils.rb
capistrano-2.5.6 test/utils.rb
capistrano-2.5.7 test/utils.rb
capistrano-2.5.8 test/utils.rb
capistrano-2.4.1 test/utils.rb