2005-08-03 08:59:03 -04:00
|
|
|
$:.unshift File.dirname(__FILE__) + "/../lib"
|
|
|
|
|
|
|
|
require 'test/unit'
|
2006-03-05 22:48:35 -05:00
|
|
|
require 'capistrano/configuration'
|
2005-08-03 08:59:03 -04:00
|
|
|
|
|
|
|
class ConfigurationTest < Test::Unit::TestCase
|
|
|
|
def setup
|
2007-02-26 18:59:33 -05:00
|
|
|
@config = Capistrano::Configuration.new
|
2006-02-18 22:16:44 -05:00
|
|
|
end
|
|
|
|
|
2005-08-03 08:59:03 -04:00
|
|
|
def test_task_without_options
|
|
|
|
block = Proc.new { }
|
|
|
|
@config.task :hello, &block
|
|
|
|
assert_equal 1, @config.actor.tasks.length
|
|
|
|
assert_equal :hello, @config.actor.tasks[0][0]
|
|
|
|
assert_equal({}, @config.actor.tasks[0][1])
|
|
|
|
assert_equal block, @config.actor.tasks[0][2]
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_task_with_options
|
|
|
|
block = Proc.new { }
|
|
|
|
@config.task :hello, :roles => :app, &block
|
|
|
|
assert_equal 1, @config.actor.tasks.length
|
|
|
|
assert_equal :hello, @config.actor.tasks[0][0]
|
|
|
|
assert_equal({:roles => :app}, @config.actor.tasks[0][1])
|
|
|
|
assert_equal block, @config.actor.tasks[0][2]
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_task_description
|
|
|
|
block = Proc.new { }
|
|
|
|
@config.desc "A sample task"
|
|
|
|
@config.task :hello, &block
|
|
|
|
assert_equal "A sample task", @config.actor.tasks[0][1][:desc]
|
|
|
|
end
|
|
|
|
end
|