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