Add tests showing how retarded my implementation is. Also remove Makefile from revisi...
t0m [Fri, 12 Dec 2008 11:52:55 +0000 (11:52 +0000)]
Changes
Makefile
lib/Catalyst/View/TT/XHTML.pm
t/live-test.t

diff --git a/Changes b/Changes
index 671edc8..ccb2c99 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,4 +1,6 @@
+  - Add tests for other Accept header cases where the current code
+    will get it wrong (David Dorward)
 1.000
   - First working version of the module extracted from the quick hack
     I have in every Catalyst application I've ever written.
-    
\ No newline at end of file
+    
index 1ec3cdf..6e9fde2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -17,9 +17,8 @@
 #     NAME => q[Catalyst::View::TT::XHTML]
 #     NO_META => q[1]
 #     PL_FILES => {  }
-#     PREREQ_PM => { Catalyst::View::TT=>q[0], ok=>q[0], Test::More=>q[0], ExtUtils::MakeMaker=>q[6.42], Catalyst::Runtime=>q[0], Test::WWW::Mechanize::Catalyst=>q[0], Catalyst::Action::RenderView=>q[0] }
-#     VERSION => q[0.001000]
-#     clean => { FILES=>q[META.yml] }
+#     PREREQ_PM => { Catalyst::View::TT=>q[0], Test::More=>q[0], ExtUtils::MakeMaker=>q[6.42], Catalyst::Runtime=>q[0], Test::WWW::Mechanize::Catalyst=>q[0], Catalyst::Action::RenderView=>q[0] }
+#     VERSION => q[1.000]
 #     dist => { PREOP=>q[$(PERL) -I. "-MModule::Install::Admin" -e "dist_preop(q($(DISTVNAME)))"] }
 
 # --- MakeMaker post_initialize section:
@@ -60,11 +59,11 @@ DIRFILESEP = /
 DFSEP = $(DIRFILESEP)
 NAME = Catalyst::View::TT::XHTML
 NAME_SYM = Catalyst_View_TT_XHTML
-VERSION = 0.001000
+VERSION = 1.000
 VERSION_MACRO = VERSION
-VERSION_SYM = 0_001000
+VERSION_SYM = 1_000
 DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
-XS_VERSION = 0.001000
+XS_VERSION = 1.000
 XS_VERSION_MACRO = XS_VERSION
 XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"
 INST_ARCHLIB = blib/arch
@@ -255,7 +254,7 @@ RCS_LABEL = rcs -Nv$(VERSION_SYM): -q
 DIST_CP = best
 DIST_DEFAULT = tardist
 DISTNAME = Catalyst-View-TT-XHTML
-DISTVNAME = Catalyst-View-TT-XHTML-0.001000
+DISTVNAME = Catalyst-View-TT-XHTML-1.000
 
 
 # --- MakeMaker macro section:
@@ -453,7 +452,7 @@ clean :: clean_subdirs
          perl.exe so_locations \
          $(BASEEXT).exp 
        - $(RM_RF) \
-         META.yml blib 
+         blib 
        - $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL)
 
 
@@ -763,7 +762,7 @@ testdb_static :: testdb_dynamic
 # --- MakeMaker ppd section:
 # Creates a PPD (Perl Package Description) for a binary distribution.
 ppd :
-       $(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="0,001000,0,0">' > $(DISTNAME).ppd
+       $(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="1,000,0,0">' > $(DISTNAME).ppd
        $(NOECHO) $(ECHO) '    <TITLE>$(DISTNAME)</TITLE>' >> $(DISTNAME).ppd
        $(NOECHO) $(ECHO) '    <ABSTRACT>A sub-class of the standard TT view which</ABSTRACT>' >> $(DISTNAME).ppd
        $(NOECHO) $(ECHO) '    <AUTHOR>Tomas Doran C&lt;&lt; &lt;bobtfish@bobtfish.net&gt; &gt;&gt;</AUTHOR>' >> $(DISTNAME).ppd
@@ -774,7 +773,6 @@ ppd :
        $(NOECHO) $(ECHO) '        <DEPENDENCY NAME="ExtUtils-MakeMaker" VERSION="6,42,0,0" />' >> $(DISTNAME).ppd
        $(NOECHO) $(ECHO) '        <DEPENDENCY NAME="Test-More" VERSION="0,0,0,0" />' >> $(DISTNAME).ppd
        $(NOECHO) $(ECHO) '        <DEPENDENCY NAME="Test-WWW-Mechanize-Catalyst" VERSION="0,0,0,0" />' >> $(DISTNAME).ppd
-       $(NOECHO) $(ECHO) '        <DEPENDENCY NAME="ok" VERSION="0,0,0,0" />' >> $(DISTNAME).ppd
        $(NOECHO) $(ECHO) '        <OS NAME="$(OSNAME)" />' >> $(DISTNAME).ppd
        $(NOECHO) $(ECHO) '        <ARCHITECTURE NAME="darwin-thread-multi-2level-5.8" />' >> $(DISTNAME).ppd
        $(NOECHO) $(ECHO) '        <CODEBASE HREF="" />' >> $(DISTNAME).ppd
index 3f3dd3a..17bf1bf 100644 (file)
@@ -71,6 +71,14 @@ SYNOPSIS).
 
 Tomas Doran C<< <bobtfish@bobtfish.net> >>
 
+=head1 CONTRIBUTORS
+
+=over
+
+=item David Dorward - test patches
+
+=back
+
 =head1 COPYRIGHT
 
 This module itself is copyright (c) 2008 Tomas Doran and is licensed under the same terms as Perl itself.
index fb058e5..58a8739 100644 (file)
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 13;
+use Test::More tests => 22;
 
 # setup library path
 use FindBin qw($Bin);
@@ -42,3 +42,27 @@ $mech->get_ok('http://localhost/nothtml', 'get nothtml page');
 $mech->content_like(qr/not html/i, 'see if it has our text');
 is $mech->response->headers->{'content-type'}, 'application/json',
   'application/json is unmolested';
+
+# 14-16
+$mech->add_header( Accept => 'text/html, application/xhtml+xml');
+$mech->get_ok('http://localhost/', 'get main page');
+$mech->content_like(qr/it works/i, 'see if it has our text');
+is $mech->response->headers->{'content-type'}, 'application/xhtml+xml; charset=utf-8',
+  'Accept xhtml AND html gives content type application/xhtml+xml';
+
+
+# 17-19
+$mech->add_header( Accept => 'text/html, application/xhtml+xml;q=0');
+$mech->get_ok('http://localhost/', 'get main page');
+$mech->content_like(qr/it works/i, 'see if it has our text');
+is $mech->response->headers->{'content-type'}, 'text/html; charset=utf-8',
+  'Accept header of application/xhtml+xml with q value of 0 and text/html = text/html';
+
+# 20-22
+$mech->add_header( Accept => 'text/html;q=0');
+$mech->get_ok('http://localhost/', 'get main page');
+$mech->content_like(qr/it works/i, 'see if it has our text');
+is $mech->response->headers->{'content-type'}, 'application/xhtml+xml; charset=utf-8',
+  'Accept html with a q value of 0 gives content type application/xhtml+xml';
+
+