r55@latte: adam | 2006-12-03 16:09:26 -0800
[catagits/Catalyst-Action-REST.git] / t / yaml-html.t
CommitLineData
e601adda 1use strict;
2use warnings;
6646fdc2 3use Test::More tests => 4;
e601adda 4use YAML::Syck;
5use FindBin;
6use Data::Dump qw(dump);
7
8use lib ( "$FindBin::Bin/lib", "$FindBin::Bin/../lib" );
9use Test::Rest;
10
11BEGIN {
12 use_ok 'Catalyst::Test', 'Test::Serialize';
13}
14
15my $has_serializer = eval "require YAML::Syck";
16SKIP: {
17 skip "YAML::Syck not available", 3, unless $has_serializer;
18
19 my $t = Test::Rest->new( 'content_type' => 'text/html' );
20
21 my $monkey_template =
22"<html><title>Test::Serialize</title><body><pre>--- \nmonkey: likes chicken!\n</pre></body></html>";
23 my $mres = request( $t->get( url => '/monkey_get' ) );
24 ok( $mres->is_success, 'GET the monkey succeeded' );
25 is( $mres->content, $monkey_template, "GET returned the right data" );
26
27 my $post_data = { 'sushi' => 'is good for monkey', };
28 my $mres_post =
29 request( $t->post( url => '/monkey_put', data => Dump($post_data) ) );
30 ok( $mres_post->is_error, "POST to the monkey failed; no deserializer." );
31
32}
331;