NAME

KelpX::Symbiosis::Test - Allow testing symbiotic environments using Kelp::Test

SYNOPSIS

# in test file
use KelpX::Symbiosis::Test;

my $t = KelpX::Symbiosis::Test->wrap(app => $kelp_app);

# continue testing using $t, just like Kelp::Test

DESCRIPTION

This module allows testing Kelp apps with Symbiosis using Kelp::Test. The problem with Kelp::Test is that it automatically runs run() on the app without any way to configure this behavior. Symbiotic apps use run_all() to run the whole environment, while run() stays the same and only runs Kelp. This module replaces those two methods and autoloads the rest of the methods from Kelp instance.

USAGE

wrap

new in 1.10

Instead of using Kelp::Test::new use KelpX::Symbiosis::Test::wrap with the same interface. Then you can create test cases not only for Kelp routes but also for the rest of Plack applications. The wrap method will return a Kelp::Test object, so refer to its documentation for more details.

HOW DOES IT WORK?

The main Kelp instance is wrapped in this module class and the resulting object is passed into Kelp::Test instead. KelpX::Symbiosis::Test autoloads Kelp methods and wraps run_all inside run, which allows Kelp::Test to use it.