mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Allow roles to be declared empty
git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@6953 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
d8d46ee839
commit
50942285c9
3 changed files with 5 additions and 5 deletions
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Allow "empty" roles to be declared [Jamis Buck]
|
||||
|
||||
* Mercurial SCM module [Tobias Luetke, Matthew Elder]
|
||||
|
||||
* Invoke all commands via sh (customizable via :default_shell) [Jamis Buck]
|
||||
|
|
|
@ -43,7 +43,6 @@ module Capistrano
|
|||
# role :web, "web2", "web3", :user => "www", :port => 2345
|
||||
def role(which, *args)
|
||||
options = args.last.is_a?(Hash) ? args.pop : {}
|
||||
raise ArgumentError, "must give at least one host" if args.empty?
|
||||
which = which.to_sym
|
||||
args.each { |host| roles[which] << ServerDefinition.new(host, options) }
|
||||
end
|
||||
|
|
|
@ -21,10 +21,9 @@ class ConfigurationRolesTest < Test::Unit::TestCase
|
|||
assert @config.roles.empty?
|
||||
end
|
||||
|
||||
def test_role_should_require_at_least_one_server
|
||||
assert_raises ArgumentError do
|
||||
@config.role :app
|
||||
end
|
||||
def test_role_should_allow_empty_list
|
||||
@config.role :app
|
||||
assert @config.roles[:app].empty?
|
||||
end
|
||||
|
||||
def test_role_with_one_argument_should_add_to_roles_collection
|
||||
|
|
Loading…
Reference in a new issue