Sha256: bd084bb69ee8217dbc1156f6656088f354a817e8db9b24c073ee439a0cb1418c

Contents?: true

Size: 878 Bytes

Versions: 9

Compression:

Stored size: 878 Bytes

Contents

require 'rubygems'
require 'bundler/setup'

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

9 entries across 9 versions & 1 rubygems

Version Path
capistrano-2.15.3 test/utils.rb
capistrano-2.15.2 test/utils.rb
capistrano-2.15.0 test/utils.rb
capistrano-2.15.1 test/utils.rb
capistrano-2.14.2 test/utils.rb
capistrano-2.14.1 test/utils.rb
capistrano-2.13.5 test/utils.rb
capistrano-2.12.0 test/utils.rb
capistrano-2.11.2 test/utils.rb