redding/sanford — pull request #131 by jcredding (2014-06-25 18:49:55+00:00)
Title: Simplify `Sanford::Runner`

This is a set of changes that simplify `Runner` and decouple
the `SanfordRunner` and the `TestRunner`. Previously, the
`TestRunner` had to jump through hoops to work with `Runner`. This
was because `Runner` was providing logic that only `SanfordRunner`
needed. This was originally done because `Runner` use to be a
mixin that was could be used to define a custom runner and
configure it with a Sanford server. This is no longer the case and
`Runner` is now a class.

`Runner` has been simplified by not deciding how its attributes
are set. It only requires a handler class and it will build the
handler. The `TestRunner` is now free to expect its attributes are
optionally passed to it. It also doesn't have to worry about being
provided or building a server data. These changes move `Runner`
logic to the `SanfordRunner` which allows it to continue to require
a request and server data are passed to it. The `SanfordRunner`
can also be more strict and not worry about defaulting attributes.

With the moving of logic into the `SanfordRunner`, it's tests have
been beefed up to ensure it is providing the behavior it should. In
addition to this, this ensures that it runs multiple before and
after callbacks in the correct order.

All of this allows the `TestRunner` and `SanfordRunner` to work as
needed without extra hoops to jump through but still allow them
to provide the desired interfaces for their contexts.

@kellyredding - Ready for review. This follows the Deas pattern as much as possible. The big differences between this and Deas is that the common `Runner` provides the `halt` behavior and response building logic. This is because in both live and test scenarios we want to build responses where as in Deas in a test environment, we just return the response or halt args as needed.