Some cleanup
[dbsrgits/DBIx-Class.git] / t / resultset_class.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use Test::More;
6 use Class::Inspector ();
7
8 unshift(@INC, './t/lib');
9 use lib 't/lib';
10 plan tests => 5;
11
12 use DBICTest;
13
14 is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICTest::BaseResultSet', 'default resultset class');
15 ok(!Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded');
16 DBICTest::Schema->source('Artist')->resultset_class('DBICNSTest::ResultSet::A');
17 ok(Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class loaded automatically');
18 is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICNSTest::ResultSet::A', 'custom resultset class set');
19
20 my $schema = DBICTest->init_schema;
21 my $resultset = $schema->resultset('Artist')->search;
22 isa_ok($resultset, 'DBICNSTest::ResultSet::A', 'resultset is custom class');