jeffmccune/puppet-webhooks — pull request #14 by jeffmccune (2013-01-28 07:25:53+00:00)
Title: Move database setup to PuppetLabs::Webhook.setup_environment

Without this patch database configuration is spread out in a number of
different places. The environment rake task, the application logic
itself, and the spec helper all have different behaviors.

This is a problem because it makes it more difficult than necessary to rig
up the application into a test harness that behaves in a similar manner to
production.

This patch addresses the problem by centralizing all of the database
initialization into a single module class method named
PuppetLabs::Webhook.setup_environment. Each of the rake environment, the
spec helper, and the application itself all call this method and do so in
a single place.

In addition, the RACK_ENV=test environment is specifically configured to
use an in-memory sqlite3 database which should make the spec tests
functional and portable.

Fix issue handling
----

Without this patch the rename from IssueJob to TrelloIssueJob missed one
constant in the IssueController class. This is a problem because issues
were not actually being handled. The root cause of the problem is that
there was no test coverage for this behavior so I overlooked it while
performing the refactoring.

This patch addresses the problem by adding very basic test coverage for an
opened issue. This does cause the fixed code path to be exercised.