Commit | Line | Data |
762a7bb2 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use Test::More; |
6 | |
7 | use lib qw(t/lib); |
762a7bb2 |
8 | |
cc6504dc |
9 | BEGIN { |
d3231653 |
10 | eval { require Class::Inspector }; |
da0d740f |
11 | if ($@ =~ m{Can.t locate Class/Inspector.pm}) { |
d3231653 |
12 | plan skip_all => "ResultSetManager requires Class::Inspector"; |
da0d740f |
13 | } else { |
14 | plan tests => 4; |
15 | } |
cc6504dc |
16 | } |
762a7bb2 |
17 | |
748ab0dc |
18 | BEGIN { |
19 | local $SIG{__WARN__} = sub {}; |
20 | require DBIx::Class::ResultSetManager; |
21 | } |
22 | |
b1fb2c94 |
23 | use DBICTest::ResultSetManager; # uses Class::Inspector |
da0d740f |
24 | |
11357d09 |
25 | my $schema = DBICTest::ResultSetManager->compose_namespace('DB'); |
762a7bb2 |
26 | my $rs = $schema->resultset('Foo'); |
27 | |
28 | ok( !DB::Foo->can('bar'), 'Foo class does not have bar method' ); |
29 | ok( $rs->can('bar'), 'Foo resultset class has bar method' ); |
b1fb2c94 |
30 | isa_ok( $rs, 'DBICTest::ResultSetManager::Foo::_resultset', 'Foo resultset class is correct' ); |
cc6504dc |
31 | is( $rs->bar, 'good', 'bar method works' ); |