puppetlabs/puppet-acceptance — pull request #260 by kbarber (2012-07-30 17:09:11+00:00)
Title: (#15699) Add methods for resolving and more adequately stubbing the forge host

If you want to see how these changes are 'used' you can view this branch:

https://github.com/kbarber/puppet/tree/ticket/2.7.x/15521-use_dynamic_forge_locale_for_acceptance

This patch includes the new 'forge' method which looks up the host using the
following mechanisms:

* return the host with the 'forge' role assigned to it
* return the value of 'forge_host' in the CONFIG hash
* default to returning 'forge-acceptance.puppetlabs.lan'

This allows us multiple mechanisms to override the forge host, with a fall back
to the static 'forge-acceptance.puppetlabs.lan' host.

It also provides wrapper methodology for stubbing a host in general
`stub_hosts_on` and provides a forge specific wrapper `stub_forge_on`
so we can make our acceptance code more DRY.

To facilitate proper 'unstubbing' this patch also introduces the capability to
declare a teardown code block, that will always be called at the end of a test
case. This is a generic method, and can now be used by anyone for purposes
beyond the initial goal of this patch.