X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F08helper.t;h=0a08aae83f0f88371276b4138ab4df7636d64bf9;hb=8c4218a5bb573d2c51dfca9381b3823e514fd9ae;hp=290553ae38689bc571a1a00f5809d2e7bc2c2e8c;hpb=f1b4a8fde8a23ab98178c8b78c43eb0c14f52130;p=catagits%2FCatalyst-Model-DBIC-Schema.git diff --git a/t/08helper.t b/t/08helper.t index 290553a..0a08aae 100644 --- a/t/08helper.t +++ b/t/08helper.t @@ -8,8 +8,8 @@ use Test::More; use Test::Exception; use Catalyst::Helper::Model::DBIC::Schema; use Storable 'dclone'; -eval "use Catalyst::Helper"; -plan skip_all => 'Catalyst::Helper required for tests' if $@; +use Data::Dumper; +use Test::Requires qw(Catalyst::Helper DBIx::Class::Schema::Loader); my $helper = Catalyst::Helper->new; $helper->{base} = $Bin; @@ -73,12 +73,13 @@ $i = instance(args => [$static, q{components=TimeStamp,Foo}]); is_deeply $i->components, ['InflateColumn::DateTime', 'TimeStamp', 'Foo'], 'two extra components'; -my $flags = qr// =~ /\^/ ? '^' : "-xism"; +# Different versions of perl and Data::Dumper serialise regexes differently +my ($flagstart, $flagend, $postflag) = Dumper(qr//) =~ m{qr/(.*?)(\)?)/([a-z]*)}; $i = instance(args => [$static, q{constraint=^(foo|bar)$}]); is $i->loader_args->{constraint}, qr/^(foo|bar)$/, 'constraint loader arg'; is $i->helper->{loader_args}{constraint}, - qq{qr/(?$flags:^(foo|bar)\$)/}, + qq{qr/$flagstart^(foo|bar)\$$flagend/$postflag}, 'constraint loader arg as string'; $i = instance(args => [$static, q{exclude=^(foo|bar)$}]); @@ -175,6 +176,9 @@ $i = instance(args => [ is $i->loader_args->{db_schema}, 'myschema', 'loader arg after connect_info'; +ok ((not exists $i->helper->{connect_info}{db_schema}), + 'loader args removed from connect_info'); + done_testing; sub instance {