Add tests which should fail, but don't.
[catagits/Catalyst-Action-REST.git] / t / view.t
CommitLineData
9a76221e 1use strict;
2use warnings;
f7754f67 3use Test::More tests => 6;
9a76221e 4use FindBin;
5
6use lib ( "$FindBin::Bin/lib", "$FindBin::Bin/../lib" );
7use Test::Rest;
8
9use_ok 'Catalyst::Test', 'Test::Serialize';
10
11my $t = Test::Rest->new( 'content_type' => 'text/view' );
12
13my $monkey_template = "I am a simple view";
14my $mres = request( $t->get( url => '/monkey_get' ) );
15ok( $mres->is_success, 'GET the monkey succeeded' );
16is( $mres->content, $monkey_template, "GET returned the right data" );
17
18my $mres_post = request( $t->post( url => '/monkey_put', data => 1 ) );
19ok( $mres_post->is_success, "POST to the monkey passed." );
20
f7754f67 21my $t2 = Test::Rest->new( 'content_type' => 'text/explodingview' );
22my $res = request( $t2->get( url => '/monkey_get' ) );
23
24ok (! $res->is_success, 'View errors result in failure');
25like( $res->content, qr/don't know how/, 'The error looks okay');
26
9a76221e 271;