Sha256: ac051da21d0b66c1e6e94feaeb3a3726e36ff156e62d5f64f77e1f6df6206ad0

Contents?: true

Size: 947 Bytes

Versions: 47

Compression:

Stored size: 947 Bytes

Contents

begin
  require 'rubygems'
  require 'redgreen' unless ENV['TM_FILENAME']
  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

47 entries across 47 versions & 3 rubygems

Version Path
capistrano-2.5.22 test/utils.rb
HeSYINUvSBZfxqA-capistrano-2.5.28 test/utils.rb
HeSYINUvSBZfxqA-capistrano-2.5.27 test/utils.rb
HeSYINUvSBZfxqA-capistrano-2.5.26 test/utils.rb
HeSYINUvSBZfxqA-capistrano-2.5.25 test/utils.rb
HeSYINUvSBZfxqA-capistrano-2.5.24 test/utils.rb
HeSYINUvSBZfxqA-capistrano-2.5.23 test/utils.rb
HeSYINUvSBZfxqA-capistrano-2.5.22 test/utils.rb
HeSYINUvSBZfxqA-capistrano-2.5.21 test/utils.rb
capistrano-2.6.1.pre test/utils.rb
capistrano-2.6.0 test/utils.rb
capistrano-2.5.21 test/utils.rb
capistrano-2.5.20 test/utils.rb
le1t0-capistrano-2.5.18.024 test/utils.rb
le1t0-capistrano-2.5.18.023 test/utils.rb
le1t0-capistrano-2.5.18.022 test/utils.rb
le1t0-capistrano-2.5.18.021 test/utils.rb
le1t0-capistrano-2.5.18.020 test/utils.rb
le1t0-capistrano-2.5.18.019 test/utils.rb
le1t0-capistrano-2.5.18.018 test/utils.rb