From: John Napiorkowski Date: Mon, 29 Dec 2014 17:57:58 +0000 (-0600) Subject: update tests for newer catalyst where UTF8 is default X-Git-Tag: 0.42~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e0bcfc9869d6c49c33d43aced9165d1df2a434bb;hp=556d7fe197591bb39b9c4ac4c113f0d83a6ed85e;p=catagits%2FCatalyst-View-TT.git update tests for newer catalyst where UTF8 is default --- diff --git a/Changes b/Changes index 3fcb57c..e096a60 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension Catalyst::View::TT. +0.42 2014-12-29 + - Fixes to test cases to be compatible with Catalyst v5.90080 + 0.41 2013-02-28 - New local attribute to let you override the default content type when no content type has been set for the response. diff --git a/lib/Catalyst/View/TT.pm b/lib/Catalyst/View/TT.pm index 3f54afd..39725f9 100644 --- a/lib/Catalyst/View/TT.pm +++ b/lib/Catalyst/View/TT.pm @@ -10,7 +10,7 @@ use Template::Timer; use MRO::Compat; use Scalar::Util qw/blessed weaken/; -our $VERSION = '0.41'; +our $VERSION = '0.42'; $VERSION = eval $VERSION; __PACKAGE__->mk_accessors('template'); @@ -230,7 +230,7 @@ sub process { } unless ( $c->response->content_type ) { - my $default = $self->content_type || 'text/html; charset=utf-8'; + my $default = $self->content_type || 'text/html; charset=UTF-8'; $c->response->content_type($default); } @@ -455,6 +455,10 @@ to search. See L for an example showing this. =head2 Unicode +B Starting with L v5.90080 unicode and encoding has been +baked into core, and the default encoding is UTF-8. The following advice +is for older versions of L + Be sure to set C<< ENCODING => 'utf-8' >> and use L if you want to use non-ascii characters (encoded as utf-8) in your templates. diff --git a/t/14alt_content_type.t b/t/14alt_content_type.t index bed2f0f..01caea8 100644 --- a/t/14alt_content_type.t +++ b/t/14alt_content_type.t @@ -6,6 +6,11 @@ use FindBin; use lib "$FindBin::Bin/lib"; use_ok('Catalyst::Test', 'TestApp'); -is(request("/test_alt_content_type")->header('Content-Type'), 'text/plain'); +# Hack to support Catalyst v5.90080+ (JNAP) +if(TestApp->can('encoding') and (my $enc = TestApp->encoding) and TestApp->can('clear_encoding')) { + is(request("/test_alt_content_type")->header('Content-Type'), "text/plain; charset=${\$enc->mime_name}", "Plain text with ${\$enc->mime_name}"); +} else { + is(request("/test_alt_content_type")->header('Content-Type'), 'text/plain', 'Plain Text'); +} done_testing;