new config option to DBICTest to let you set an alternative storage type, start on...
[dbsrgits/DBIx-Class.git] / t / 32connect_code_ref.t
CommitLineData
f733d664 1use strict;
2use warnings;
3
4use Test::More;
5use lib qw(t/lib);
6use DBICTest;
7
8plan tests => 1;
9
10# Set up the "usual" sqlite for DBICTest
11my $normal_schema = DBICTest->init_schema;
12
13# Steal the dsn, which should be like 'dbi:SQLite:t/var/DBIxClass.db'
14my $normal_dsn = $normal_schema->storage->connect_info->[0];
15
16# Make sure we have no active connection
17$normal_schema->storage->disconnect;
18
19# Make a new clone with a new connection, using a code reference
20my $code_ref_schema = $normal_schema->connect(sub { DBI->connect($normal_dsn); });
21
22# Stolen from 60core.t - this just verifies things seem to work at all
23my @art = $code_ref_schema->resultset("Artist")->search({ }, { order_by => 'name DESC'});
24cmp_ok(@art, '==', 3, "Three artists returned");