live_view_warnings.t -> live_mvc_warnings.t
André Walker [Thu, 21 Jul 2011 21:26:41 +0000 (18:26 -0300)]
t/aggregate/live_mvc_warnings.t [new file with mode: 0644]
t/aggregate/live_view_warnings.t [deleted file]
t/lib/TestAppMVCWarnings.pm [new file with mode: 0644]
t/lib/TestAppMVCWarnings/Controller/Root.pm [new file with mode: 0644]
t/lib/TestAppViewWarnings.pm [deleted file]
t/lib/TestAppViewWarnings/Controller/Root.pm [deleted file]

diff --git a/t/aggregate/live_mvc_warnings.t b/t/aggregate/live_mvc_warnings.t
new file mode 100644 (file)
index 0000000..5d940a0
--- /dev/null
@@ -0,0 +1,25 @@
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More;
+use Catalyst::Test 'TestAppMVCWarnings';
+
+if ( $ENV{CATALYST_SERVER} ) {
+    plan skip_all => 'Using remote server';
+}
+
+{
+    ok( request('http://localhost/view'), 'Request' );
+    like($TestAppMVCWarnings::log_messages[0], qr/Calling \$c->view\(\) is not supported/s, 'View failure warning received');
+
+    @TestAppMVCWarnings::log_messages = ();
+
+    ok( request('http://localhost/model'), 'Request' );
+    like($TestAppMVCWarnings::log_messages[0], qr/Calling \$c->model\(\) is not supported/s, 'Model failure warning received');
+}
+
+done_testing;
+
diff --git a/t/aggregate/live_view_warnings.t b/t/aggregate/live_view_warnings.t
deleted file mode 100644 (file)
index 50684f1..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#!perl
-
-use strict;
-use warnings;
-
-use FindBin;
-use lib "$FindBin::Bin/../lib";
-
-use Test::More;
-use Catalyst::Test 'TestAppViewWarnings';
-
-if ( $ENV{CATALYST_SERVER} ) {
-    plan skip_all => 'Using remote server';
-}
-
-{
-    ok( my $response = request('http://localhost/'), 'Request' );
-
-    like($TestAppViewWarnings::log_messages[0], qr/Calling \$c->view\(\) is not supported/s, 'View failure warning received');
-
-}
-
-done_testing;
-
diff --git a/t/lib/TestAppMVCWarnings.pm b/t/lib/TestAppMVCWarnings.pm
new file mode 100644 (file)
index 0000000..e0aebdf
--- /dev/null
@@ -0,0 +1,20 @@
+package TestAppMVCWarnings;
+use Moose;
+extends 'Catalyst';
+use Catalyst;
+
+our @log_messages;
+
+__PACKAGE__->config( name => 'TestAppMVCWarnings', root => '/some/dir', default_view => "DoesNotExist" );
+
+__PACKAGE__->log(TestAppMVCWarnings::Log->new);
+
+__PACKAGE__->setup;
+
+package TestAppMVCWarnings::Log;
+use Moose;
+extends q/Catalyst::Log/;
+
+sub warn { push(@TestAppMVCWarnings::log_messages, @_[1..$#_]); }
+
+1;
diff --git a/t/lib/TestAppMVCWarnings/Controller/Root.pm b/t/lib/TestAppMVCWarnings/Controller/Root.pm
new file mode 100644 (file)
index 0000000..dc3b9b4
--- /dev/null
@@ -0,0 +1,21 @@
+package TestAppMVCWarnings::Controller::Root;
+use Moose;
+BEGIN { extends 'Catalyst::Controller' };
+
+__PACKAGE__->config->{namespace} = '';
+
+sub index :Path Args() {}
+
+sub model : Local {
+    my ($self, $c) = @_;
+    $c->model; # Cause model lookup and ergo warning we are testing.
+    $c->res->body('foo');
+}
+
+sub view : Local {
+    my ($self, $c) = @_;
+    $c->view; # Cause view lookup and ergo warning we are testing.
+    $c->res->body('bar');
+}
+
+1;
diff --git a/t/lib/TestAppViewWarnings.pm b/t/lib/TestAppViewWarnings.pm
deleted file mode 100644 (file)
index 3a9102c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-use strict;
-use warnings;
-
-package TestAppViewWarnings;
-
-use Catalyst;
-
-our @log_messages;
-
-__PACKAGE__->config( name => 'TestAppWarnings', root => '/some/dir', default_view => "DoesNotExist" );
-
-__PACKAGE__->log(TestAppViewWarnings::Log->new);
-
-__PACKAGE__->setup;
-
-package TestAppViewWarnings::Log;
-
-use base qw/Catalyst::Log/;
-sub warn { push(@TestAppViewWarnings::log_messages, @_[1..$#_]); }
-
-1;
-
diff --git a/t/lib/TestAppViewWarnings/Controller/Root.pm b/t/lib/TestAppViewWarnings/Controller/Root.pm
deleted file mode 100644 (file)
index 6d252f8..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-package TestAppViewWarnings::Controller::Root;
-use strict;
-use warnings;
-use base 'Catalyst::Controller';
-
-__PACKAGE__->config->{namespace} = '';
-
-# Return log messages from previous request
-sub index :Path Args() {}
-
-sub end : Action {
-    my ($self, $c) = @_;
-    $c->view; # Cause view lookup and ergo warning we are testing.
-    $c->res->body('foo');
-}
-
-1;