X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Funit_core_mvc.t;h=549d758ca68791fb7a9acdfe3ff5a0a14c512e61;hb=8c25d85b1c79a9671c0e81e65c5ff5c112e8399f;hp=4c83859bc3390c38c7560e3c78c498569bd7c6f2;hpb=aa61c19093ccde10f79f746daee1387748590f43;p=catagits%2FCatalyst-Runtime.git diff --git a/t/unit_core_mvc.t b/t/unit_core_mvc.t index 4c83859..549d758 100644 --- a/t/unit_core_mvc.t +++ b/t/unit_core_mvc.t @@ -1,4 +1,4 @@ -use Test::More tests => 43; +use Test::More tests => 44; use strict; use warnings; @@ -147,14 +147,20 @@ is ( MyApp->model , 'MyApp::Model::M', 'default_model in class method ok'); } #checking @args passed to ACCEPT_CONTEXT -my $args; { + my $args; + no warnings; *MyApp::Model::M::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args}; *MyApp::View::V::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args}; -} -MyApp->model('M', qw/foo bar/); -is_deeply($args, [qw/foo bar/], '$c->model args passed to ACCEPT_CONTEXT ok'); -MyApp->view('V', qw/baz moo/); -is_deeply($args, [qw/baz moo/], '$c->view args passed to ACCEPT_CONTEXT ok'); + MyApp->model('M', qw/foo bar/); + is_deeply($args, [qw/foo bar/], '$c->model args passed to ACCEPT_CONTEXT ok'); + + my $x = MyApp->view('V', qw/foo2 bar2/); + is_deeply($args, [qw/foo2 bar2/], '$c->view args passed to ACCEPT_CONTEXT ok'); + + # regexp fallback + MyApp->view('::View::V', qw/foo3 bar3/); + is_deeply($args, [qw/foo3 bar3/], 'args passed to ACCEPT_CONTEXT ok'); +}