Permalink
Browse files

changelog, tests for HOSTS change

  • Loading branch information...
1 parent 8087eaa commit f6d3442b9c7491a008fb8f11192853411437b5b3 @jamis jamis committed Aug 26, 2008
Showing with 17 additions and 0 deletions.
  1. +2 −0 CHANGELOG.rdoc
  2. +15 −0 test/configuration/servers_test.rb
View
@@ -1,5 +1,7 @@
== (unreleased)
+* Allow HOSTS spec to override even non-existent roles [Mike Bailey]
+
* Sort releases via "ls -xt" instead of "ls -x" to allow for custom release names [Yan Pritzker]
* Convert arguments to -s and -S into integers, booleans, etc. based on whether the arguments appear to be those types [Jamis Buck]
@@ -37,6 +37,13 @@ def test_task_with_single_role_should_apply_only_to_that_role
assert_equal %w(web1 web2).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
end
+ def test_task_with_unknown_role_should_raise_exception
+ task = new_task(:testing, @config, :roles => :bogus)
+ assert_raises(ArgumentError) do
+ @config.find_servers_for_task(task)
+ end
+ end
+
def test_task_with_hosts_option_should_apply_only_to_those_hosts
task = new_task(:testing, @config, :hosts => %w(foo bar))
assert_equal %w(foo bar).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
@@ -63,6 +70,14 @@ def test_task_with_hosts_as_environment_variable_should_apply_only_to_those_host
ENV['HOSTS'] = nil
end
+ def test_task_with_hosts_as_environment_variable_should_not_inspect_roles_at_all
+ ENV['HOSTS'] = "foo,bar"
+ task = new_task(:testing, @config, :roles => :bogus)
+ assert_equal %w(foo bar).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
+ ensure
+ ENV['HOSTS'] = nil
+ end
+
def test_task_with_only_should_apply_only_to_matching_tasks
task = new_task(:testing, @config, :roles => :app, :only => { :primary => true })
assert_equal %w(app1), @config.find_servers_for_task(task).map { |s| s.host }

0 comments on commit f6d3442

Please sign in to comment.