Skip to content

Commit

Permalink
changelog, tests for HOSTS change
Browse files Browse the repository at this point in the history
  • Loading branch information
jamis committed Aug 26, 2008
1 parent 8087eaa commit f6d3442
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rdoc
@@ -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]
Expand Down
15 changes: 15 additions & 0 deletions test/configuration/servers_test.rb
Expand Up @@ -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
Expand All @@ -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 }
Expand Down

0 comments on commit f6d3442

Please sign in to comment.