X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F09schema_options.t;fp=t%2F09schema_options.t;h=af1356cb5b77dc4c08e5557d9ae34b7fb3660bf0;hb=21d8159f80adbd21755cdd5481e9f4cf2f9a5ac2;hp=d1e1c80f6a871f15b972e18615815e9b91e12226;hpb=510629748f0214f9e8bed35502a90edf7b6d589e;p=catagits%2FCatalyst-Model-DBIC-Schema.git diff --git a/t/09schema_options.t b/t/09schema_options.t index d1e1c80..af1356c 100644 --- a/t/09schema_options.t +++ b/t/09schema_options.t @@ -8,8 +8,10 @@ use Test::More; use Test::Exception; use Catalyst::Model::DBIC::Schema; use ASchemaClass; +use AnotherSchemaClass; -plan tests => 4; +# reusing the same app for 2 models, gets a redefined warning +$SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /redefined/ }; ok((my $m = instance(a_schema_option => 'mtfnpy')), 'instance'); @@ -19,8 +21,15 @@ lives_ok { $m->a_schema_option('pass the crack pipe') } 'delegate called'; is $m->schema->a_schema_option, 'pass the crack pipe', 'delegation works'; +ok(($m = instance(schema_class => 'AnotherSchemaClass')), 'instance'); + +is $m->resultset('Users')->rs_config_option, 'configured rs value', + 'ResultSet option passed from config'; + +done_testing; + sub instance { - Catalyst::Model::DBIC::Schema->COMPONENT('MyApp', { + MyApp::Model::DB->COMPONENT('MyApp', { traits => 'SchemaProxy', schema_class => 'ASchemaClass', connect_info => ['dbi:SQLite:foo.db', '', ''], @@ -28,4 +37,17 @@ sub instance { }) } -{ package MyApp; use Catalyst; } +BEGIN { + package MyApp; + use Catalyst; + __PACKAGE__->config({ + 'Model::DB::Users' => { + rs_config_option => 'configured rs value', + }, + }); +} + +{ + package MyApp::Model::DB; + use base 'Catalyst::Model::DBIC::Schema'; +}