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 831e62fecd71636284d1880fbfade4158ac800e7 Author: Alexis Sukrieh <suk...@sukria.net> Date: Thu Oct 14 10:49:45 2010 +0200 100% cover rate --- t/02_prepare_serializer_for_format.t | 2 -- ...erializer_for_format.t => 04_plugin_settings.t} | 38 ++++++++++++++-------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/t/02_prepare_serializer_for_format.t b/t/02_prepare_serializer_for_format.t index bc4a57b..2eca254 100644 --- a/t/02_prepare_serializer_for_format.t +++ b/t/02_prepare_serializer_for_format.t @@ -62,5 +62,3 @@ for my $test ( @tests ) { is( $response->{content}, $test->{response}, "\$data has been encoded" ); } - - diff --git a/t/02_prepare_serializer_for_format.t b/t/04_plugin_settings.t similarity index 57% copy from t/02_prepare_serializer_for_format.t copy to t/04_plugin_settings.t index bc4a57b..9cde91d 100644 --- a/t/02_prepare_serializer_for_format.t +++ b/t/04_plugin_settings.t @@ -17,6 +17,15 @@ my $yaml = YAML::Dump($data); use Dancer; use Dancer::Plugin::REST; + setting plugins => { + REST => { + serializers => { + 'yaml' => 'YAML', + 'json' => 'NotExists', + } + } + }; + prepare_serializer_for_format; get '/' => sub { "root" }; @@ -31,36 +40,39 @@ use TestUtils; my @tests = ( { request => [GET => '/'], - content_type => 'text/html', response => 'root', }, { request => [GET => '/foo.json'], - content_type => 'application/json', - response => $json + response => qr/Error 500.*Unable to process your query/ms }, { - request => [GET => '/foo.yml'], - content_type => 'text/x-yaml', + request => [GET => '/foo.yaml'], response => $yaml, }, + { + request => [GET => '/foo.foobar'], + response => qr/unsupported format requested: foobar/ms, + }, { request => [GET => '/'], - content_type => 'text/html', response => 'root', }, ); -plan tests => scalar(@tests) * 2; +plan tests => scalar(@tests); for my $test ( @tests ) { my $response = get_response_for_request(@{$test->{request}}); - is_deeply( $response->{headers}, - [ 'Content-Type' => $test->{content_type}], - "headers have content_type set to ".$test->{content_type}); - - is( $response->{content}, $test->{response}, - "\$data has been encoded" ); + if (ref($test->{response})) { + like( $response->{content}, $test->{response}, + "response looks good for '@{$test->{request}}'" ); + } + else { + is( $response->{content}, $test->{response}, + "response looks good for '@{$test->{request}}'" ); + } } + -- 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