r53@latte: adam | 2006-12-03 16:00:44 -0800
[catagits/Catalyst-Action-Serialize-Data-Serializer.git] / t / yaml-html.t
diff --git a/t/yaml-html.t b/t/yaml-html.t
new file mode 100644 (file)
index 0000000..fc6fa03
--- /dev/null
@@ -0,0 +1,33 @@
+use strict;
+use warnings;
+use Test::More qw(no_plan);
+use YAML::Syck;
+use FindBin;
+use Data::Dump qw(dump);
+
+use lib ( "$FindBin::Bin/lib", "$FindBin::Bin/../lib" );
+use Test::Rest;
+
+BEGIN {
+    use_ok 'Catalyst::Test', 'Test::Serialize';
+}
+
+my $has_serializer = eval "require YAML::Syck";
+SKIP: {
+    skip "YAML::Syck not available", 3, unless $has_serializer;
+
+    my $t = Test::Rest->new( 'content_type' => 'text/html' );
+
+    my $monkey_template =
+"<html><title>Test::Serialize</title><body><pre>--- \nmonkey: likes chicken!\n</pre></body></html>";
+    my $mres = request( $t->get( url => '/monkey_get' ) );
+    ok( $mres->is_success, 'GET the monkey succeeded' );
+    is( $mres->content, $monkey_template, "GET returned the right data" );
+
+    my $post_data = { 'sushi' => 'is good for monkey', };
+    my $mres_post =
+      request( $t->post( url => '/monkey_put', data => Dump($post_data) ) );
+    ok( $mres_post->is_error, "POST to the monkey failed; no deserializer." );
+
+}
+1;