This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag 0.07
in repository libdancer-plugin-rest-perl.

commit be0f0e63154e162d5959943a89e4f9e160b3d78f
Author: Alexis Sukrieh <suk...@sukria.net>
Date:   Sat Apr 3 16:54:19 2010 +0200

    test scrtipt for prepare_serializer_for_format
---
 t/02_prepare_serializer_for_format.t | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/t/02_prepare_serializer_for_format.t 
b/t/02_prepare_serializer_for_format.t
new file mode 100644
index 0000000..5217970
--- /dev/null
+++ b/t/02_prepare_serializer_for_format.t
@@ -0,0 +1,35 @@
+use strict;
+use warnings;
+use Dancer::ModuleLoader;
+use Test::More import => ['!pass'];
+
+plan skip_all => "JSON is needed for this test"
+    unless Dancer::ModuleLoader->load('JSON');
+plan tests => 3;
+
+my $data = { foo => 42 };
+my $json = JSON::encode_json($data);
+
+{
+    package Webservice;
+    use Dancer;
+    use Dancer::Plugin::REST;
+
+    prepare_serializer_for_format;
+
+    get '/foo.:format' => sub {
+        $data;
+    };
+}
+
+use lib 't';
+use TestUtils;
+
+my $response = get_response_for_request(GET => '/foo.json');
+ok(defined($response), "response found for /foo.json");
+
+is_deeply( $response->{headers}, [ 'Content-Type' => 'application/json'],
+    "headers have content_type set to application/json" );
+
+is( $response->{content}, $json,
+    "\$data has been encoded to JSON");

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libdancer-plugin-rest-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to