don't mess with the class attribute
[catagits/Catalyst-Runtime.git] / t / forward_instances.t
CommitLineData
978a9a4a 1use warnings;
2use strict;
3use Test::More;
4
5# Test case for reported issue when an action consumes JSON but a
6# POST sends nothing we get a hard error
7
8{
9 package MyApp::Controller::Root;
10 $INC{'MyApp/Controller/Root.pm'} = __FILE__;
11
12 use base 'Catalyst::Controller';
13
191df47e 14 sub test_forward :Local Args(0) {
978a9a4a 15 my( $self, $c ) = @_;
16 my $view = $c->view('Test');
17 $c->forward($view);
18
19 Test::More::is("$view", "@{[ $c->res->body]}");
20 }
21
22 package MyApp::View::Test;
23 $INC{'MyApp/View/Test.pm'} = __FILE__;
24
25 use base 'Catalyst::View';
26
27 sub ACCEPT_CONTEXT {
28 my ($self, $c, @args) = @_;
29 return ref($self)->new;
30 }
31
32 sub process {
33 my ($self, $c, @args) = @_;
34 $c->res->body("$self");
978a9a4a 35 }
36
37 package MyApp;
38 use Catalyst;
39 MyApp->setup;
40}
41
42use HTTP::Request::Common;
43use Catalyst::Test 'MyApp';
44
45{
191df47e 46 ok my $res = request GET 'root/test_forward';
978a9a4a 47}
48
49done_testing(2);