r55@latte: adam | 2006-12-03 16:09:26 -0800
[catagits/Catalyst-Action-REST.git] / t / yaml-html.t
1 use strict;
2 use warnings;
3 use Test::More tests => 4;
4 use YAML::Syck;
5 use FindBin;
6 use Data::Dump qw(dump);
7
8 use lib ( "$FindBin::Bin/lib", "$FindBin::Bin/../lib" );
9 use Test::Rest;
10
11 BEGIN {
12     use_ok 'Catalyst::Test', 'Test::Serialize';
13 }
14
15 my $has_serializer = eval "require YAML::Syck";
16 SKIP: {
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 }
33 1;